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.order.OrderAndPlanDataReqDTO;
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
import com.zt.plat.module.contractorder.api.dto.order.SalesOrdDtlDTO;
import com.zt.plat.module.contractorder.api.dto.order.UpdateOrderLstQtyDTO;
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.validation.annotation.Validated;
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 OrderApi {
    String PREFIX = ApiConstants.PREFIX + "/order";
    @PostMapping(PREFIX + "/order-by-order-ids")
    @Operation(summary = "通过订单id获取订单信息", description = "通过订单编号获取订单信息")
    CommonResult<List<OrderDTO>> getOrderByOrderIds(@RequestBody List<Long> ids);

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

    @PostMapping(PREFIX + "/update-lst-qty-by-order-id")
    @Operation(summary = "根据订单明细id更新累积量", description = "根据订单明细id更新收货量")
    CommonResult<Boolean> updateOrderLstQty(@RequestBody @Validated List<UpdateOrderLstQtyDTO> updateOrderLstQtyDTOS);

    @PostMapping(PREFIX + "/void-lst-qty-by-order-id")
    @Operation(summary = "根据订单明细id更新累积量(冲销)", description = "根据订单明细id更新收货量(冲销)")
    CommonResult<Boolean> voidOrderLstQty(@RequestBody @Validated List<UpdateOrderLstQtyDTO> updateOrderLstQtyDTOS);

    @PostMapping(PREFIX + "/get-salas-order-details-by-ids")
    @Operation(summary = "通过销售订单明细id获取销售订单详情", description = "通过销售订单明细id获取销售订单详情")
    CommonResult<List<SalesOrdDtlDTO>> getSalesOrderDetailsByIds(@RequestBody List<Long> ids);

    @GetMapping(PREFIX + "/get-salas-order-details-by-id")
    @Operation(summary = "通过销售订单明细id获取销售订单详情", description = "通过销售订单明细id获取销售订单详情")
    CommonResult<SalesOrdDtlDTO> getSalesOrderDetailsById(@RequestParam("id") Long id);

    @PostMapping(PREFIX + "/query-order-plan-data")
    @Operation(summary = "根据计划和订单的参数查询相关的订单", description = "根据计划和订单的参数查询相关的订单")
    CommonResult<PageResult<OrderDTO>> queryOrderPlanData(@RequestBody @Valid OrderAndPlanDataReqDTO reqVO);
}
