package com.zt.plat.module.contractorder.api;


import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.contractorder.api.dto.contract.ContractRespDTO;
import com.zt.plat.module.contractorder.api.dto.order.PrchOrdDtlDTO;
import com.zt.plat.module.contractorder.api.dto.order.PurchaseOrderWithDetailsDTO;
import com.zt.plat.module.contractorder.api.dto.order.SalesOrdDtlDTO;
import com.zt.plat.module.contractorder.api.vo.contract.international.IntContract;
import com.zt.plat.module.contractorder.api.vo.contract.international.IntContractPageReq;
import com.zt.plat.module.contractorder.api.vo.contract.international.IntPushContractReqVO;
import com.zt.plat.module.contractorder.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 合同")
public interface ContractApi {
    String PREFIX = ApiConstants.PREFIX + "/contract";

    @GetMapping(PREFIX + "/get/by-paper-number")
    @Operation(summary = "通过合同编号获取对应的合同信息")
    ContractRespDTO getContractByPaperNumber(@RequestParam("contractPaperNumber") String contractPaperNumber);

    @GetMapping(PREFIX + "/get/by-sys-number")
    @Operation(summary = "通过合同编号获取对应的合同信息")
    ContractRespDTO getFormulasBySysNumber(@RequestParam("contractSysNumber") String contractSysNumber);

    @GetMapping(PREFIX + "/updateOrderStatus")
    @Operation(summary = "更新订单状态")
    CommonResult<Boolean> updateOrderStatus(@RequestParam("orderId") Long orderId, @RequestParam("status") String status);

    @PostMapping(PREFIX + "/order-by-order-no")
    @Operation(summary = "通过订单编号获取订单信息", description = "通过订单编号获取订单信息")
    CommonResult<List<PurchaseOrderWithDetailsDTO>> getOrderByOrderNo(@RequestBody List<String> orderNoS);

    @PostMapping(PREFIX + "/order-by-order-id")
    @Operation(summary = "通过订单id获取订单信息", description = "通过订单编号获取订单信息")
    CommonResult<List<PurchaseOrderWithDetailsDTO>> getOrderByOrderIds(@RequestBody List<Long> ids);

    @PostMapping(PREFIX + "/push")
    @Operation(summary = "国贸2.0系统推送合同")
    void push(@Valid @RequestBody IntPushContractReqVO pushReqVO);

    @GetMapping(PREFIX + "/logistics/list/page")
    @Operation(summary = "国贸2.0系统合同分页查询")
    CommonResult<PageResult<IntContract>> logisticsListPage(IntContractPageReq pageReq);

    @GetMapping(PREFIX + "/sales-order-detail-by-id")
    @Operation(summary = "通过消费订单详情id获取消费订单详情")
    CommonResult<SalesOrdDtlDTO> getSalesOrderDetailById(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/sales-order-detail-by-ids")
    @Operation(summary = "通过消费订单详情id批量获取消费订单详情")
    CommonResult<List<SalesOrdDtlDTO>> getSalesOrderDetailByIds(@RequestParam("ids") List<Long> ids);

    @GetMapping(PREFIX + "/po-order-detail-by-id")
    @Operation(summary = "通过采购订单详情id获取消费订单详情")
    CommonResult<PrchOrdDtlDTO> getPoOrderDetailById(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/po-order-detail-by-ids")
    @Operation(summary = "通过采购订单详情id批量获取消费订单详情")
    CommonResult<List<PrchOrdDtlDTO>> getPoOrderDetailByIds(@RequestParam("ids") List<Long> ids);

    //销售采购融合。主子表
}
