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

import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.erp.api.dto.*;
import com.zt.plat.module.erp.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.HashMap;
import java.util.Map;

@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - ERP")
public interface ErpExternalApi {

    String PREFIX = ApiConstants.PREFIX + "/erp-external";

    @PostMapping(PREFIX + "/submit")
    @Operation(summary = "erp数据提交")
    Map<String, String> submitDataToErp(@Valid @RequestBody ErpSubmitReqDTO reqDTO);

    @PostMapping(PREFIX + "/query")
    @Operation(summary = "erp数据查询")
    Map<String, Object> queryDataToErp(@Valid @RequestBody ErpQueryReqDTO reqDTO);

    @PostMapping(PREFIX + "/queryProductiveVersion")
    @Operation(summary = "生产版本数据查询")
    CommonResult<String> getErpProductiveVersionByFM(@Valid @RequestBody ErpProductiveVersionReqDTO reqDTO);

    @GetMapping(PREFIX + "/getMaterialUnit")
    @Operation(summary = "根据物料编码查询对应计量单位")
    CommonResult<String> getMaterialUnit(@RequestParam("downCenterNumber") String downCenterNumber);

    @GetMapping(PREFIX + "/getErpWarehouse")
    @Operation(summary = "根据id获得ERP库位")
    CommonResult<ErpWarehouseDTO> getErpWarehouse(@RequestParam("id") Long id);
}
