package com.xisc.pm.infra.feign;

import com.xisc.pm.api.dto.ObtainWitnessPointDTO;
import com.xisc.pm.api.dto.PreOptimalChargingDTO;
import com.xisc.pm.api.dto.QdMatchParamDTO;
import com.xisc.pm.api.dto.QdSurplusLowMagnificationDTO;
import com.xisc.pm.infra.feign.fallback.QdOrderApiFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 质量模块合同接口
 * 
 * @author jun.zeng
 *
 */
@FeignClient(value = "${xisc.service.qd.name:xisc-qd}", fallbackFactory = QdOrderApiFeignFallbackFactory.class)
public interface QdOrderApiFeign {

    /**
     * 获取质量设计合同信息
     *
     * @param organizationId
     * @param orderNoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/api/order-api"})
    ResponseEntity<String> orderApi(@PathVariable Long organizationId, @RequestBody List<String> orderNoList);

    /**
     * 获取质量设计合同产线工艺参数信息
     *
     * @param organizationId
     * @param orderNoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/api/order-tech-api"})
    ResponseEntity<String> orderTechApi(@PathVariable Long organizationId, @RequestBody List<String> orderNoList);

    /**
     * 预组炉以优充次化学成分校验
     *
     * @param organizationId
     * @param dtoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/api/pre-optimal-charging-api"})
    ResponseEntity<String> preOptimalChargingApi(@PathVariable Long organizationId,
                                                 @RequestBody List<PreOptimalChargingDTO> dtoList);

    /**
     * 实物炉次化学成分与合同匹配
     *
     * @param organizationId
     * @param dtoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/api/phy-furnace-chemical-match-api"})
    ResponseEntity<String> phyFurnaceChemicalMatchApi(@PathVariable Long organizationId,
                                                      @RequestBody List<QdMatchParamDTO> dtoList);

    /**
     * 余坯组板低倍材料与合同低倍要求匹配
     *
     * @param organizationId
     * @param dtoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/api/surplus-low-magnification-match-api"})
    ResponseEntity<String> surplusLowMagnificationMatchApi(@PathVariable Long organizationId,
                                                           @RequestBody List<QdSurplusLowMagnificationDTO> dtoList);

    /**
     * 按合同号获取见证点状态
     *
     * @param organizationId
     * @param dtoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/api/obtain-witness-point"})
    ResponseEntity<String> obtainWitnessPointApi(@PathVariable Long organizationId,
                                                       @RequestBody List<ObtainWitnessPointDTO> dtoList);
}