package com.inkasso.factoring.salesManagement.web;

import com.inkasso.auth.response.ResponseJson;
import com.inkasso.factoring.salesManagement.entity.CSalesContractSupplementBasicInfo;
import com.inkasso.factoring.salesManagement.entity.CSalesContractSupplementInfo;
import com.inkasso.factoring.salesManagement.entity.CSalesSupplementSignConfirmation;
import com.inkasso.factoring.salesManagement.entity.vo.SalesSignConfirmVo;
import com.inkasso.factoring.salesManagement.service.ICSalesContractSupplementBasicInfoService;
import com.inkasso.factoring.salesManagement.service.ICSalesContractSupplementInfoService;
import com.inkasso.factoring.salesManagement.service.ICSalesSignConfirmationService;
import com.inkasso.factoring.salesManagement.service.ICSalesSupplementSignConfirmationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 销售合同变更
 * @Author Yafan Wang
 * @Date 2024/1/6 15:53
 */
@RestController
@RequestMapping("/salesContract/change")
public class CSalesContractSupplementController {

    @Autowired
    private ICSalesContractSupplementInfoService salesContractSupplementInfoService;
    @Autowired
    private ICSalesContractSupplementBasicInfoService salesContractSupplementBasicInfoService;
    @Autowired
    private ICSalesSupplementSignConfirmationService salesSupplementSignConfirmationService;


    /**
     * 合同变更
     * @param id
     * @return
     */
    @GetMapping("/add")
    public ResponseJson add(Long id){
        return new ResponseJson(salesContractSupplementInfoService.add(id));
    }


    /**
     * 变更提交
     * @param salesContractSupplementInfo
     * @return
     */
    @PostMapping("/doAdd")
    public ResponseJson doAdd(@RequestBody CSalesContractSupplementInfo salesContractSupplementInfo){
        salesContractSupplementInfoService.doChange(salesContractSupplementInfo);
        return new ResponseJson("操作成功！");
    }

    /**
     * 变更录入
     * @param id
     * @return
     */
    @GetMapping("/enter")
    public ResponseJson enter(Long id){
        return new ResponseJson(salesContractSupplementBasicInfoService.add(id));
    }

    /**
     * 变更录入-提交
     * @param supplementBasicInfo
     * @return
     */
    @PostMapping("/doEnter")
    public ResponseJson doEnter(@RequestBody CSalesContractSupplementBasicInfo supplementBasicInfo){
        salesContractSupplementBasicInfoService.doAdd(supplementBasicInfo);
        return new ResponseJson("操作成功！");
    }

    /**
     *  签署确认信息
     * @param id
     * @return
     */

    @GetMapping("/sign")
    public ResponseJson sign(Long id){
        return new ResponseJson(salesSupplementSignConfirmationService.add(id));
    }

    /**
     *  签署确认-提交
     * @param supplementSignConfirmation
     * @return
     */

    @PostMapping("/doSign")
    public ResponseJson doSign(@RequestBody CSalesSupplementSignConfirmation supplementSignConfirmation){
        salesSupplementSignConfirmationService.doAdd(supplementSignConfirmation);
        return new ResponseJson("操作成功！");
    }



}
