package com.cool.store.controller.webb;

import com.cool.store.dto.contract.ContractConfigDTO;
import com.cool.store.dto.contract.ContractListDTO;
import com.cool.store.dto.contract.QueryContractListDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ContractConfigService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.xml.ws.Response;

/**
 * @Author suzhuhong
 * @Date 2025/9/9 10:03
 * @Version 1.0
 */
@RestController
@RequestMapping("pc/contract")
@Api(tags = "PC-合同配置")
@Slf4j
public class ContractConfigController {


    @Resource
    private ContractConfigService contractConfigService;

    @PostMapping("/addContractConfig")
    @ApiOperation("添加合同配置")
    public ResponseResult<Boolean> addContractConfig(@RequestBody @Validated ContractConfigDTO addContractConfigDTO) {
        return ResponseResult.success(contractConfigService.addContractConfig(addContractConfigDTO));
    }

    @PostMapping("/updateContractConfig")
    @ApiOperation("更新合同配置")
    public ResponseResult<Boolean> updateContractConfig(@RequestBody @Validated ContractConfigDTO addContractConfigDTO) {
        return ResponseResult.success(contractConfigService.updateContractConfig(addContractConfigDTO));
    }

    @PostMapping("/queryContractConfigList")
    @ApiOperation("合同配置列表")
    public ResponseResult<PageInfo<ContractListDTO>> queryContractConfigList(@RequestBody QueryContractListDTO queryContractListDTO) {
        return ResponseResult.success(contractConfigService.queryContractConfigList(queryContractListDTO));
    }

    @GetMapping("/deleteContractConfig")
    @ApiOperation("删除配置")
    public ResponseResult<Boolean> deleteContractConfig(Long id) {
        return ResponseResult.success(contractConfigService.deleteContractConfig(id));
    }


}
