package com.prolog.cs.biz.outbound.resource;

import com.prolog.cs.basic.chain.model.cargo.BaseCargoOwnerMst;
import com.prolog.cs.basic.chain.model.carrier.BaseCarrierMst;
import com.prolog.cs.basic.chain.model.customer.BaseCustomerMst;
import com.prolog.cs.basic.chain.model.customer.BaseCustomerSitesAll;
import com.prolog.cs.basic.chain.model.customer.vo.BaseCustomerMstRequestVO;
import com.prolog.cs.basic.chain.model.customer.vo.CustomerAndSupplierQueryVO;
import com.prolog.cs.basic.chain.model.supplier.BaseSupplierMst;
import com.prolog.cs.basic.chain.vo.carrier.BaseCarrierMstRequestVO;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;
import java.util.Set;

@FeignClient(value = "${prolog.service.chain}")
public interface ChainResource {

    @PostMapping("/baseCustomerMst/v1.0/findAll")
    RestMessage<List<BaseCustomerMst>> findAll(@RequestBody BaseCustomerMstRequestVO request);

    /**
     * 根据id集合查货主列表
     *
     * @param idSet
     * @return 返回数据为 Map(cargoOwnerId, baseCargoOwnerMst)
     */
    @PostMapping("/baseCargoOwnerMst/v1.0/getByIds")
    RestMessage<Map<String, BaseCargoOwnerMst>> getCargoOwnerByIds(@RequestBody Set<String> idSet);

    /**
     * 主键id查询单条
     */
    @PostMapping("/baseCustomerMst/v1.0/findAllHealTh")
    public RestMessage<List<BaseCustomerSitesAll>> findAllHealTh(@RequestBody List<String> customerIds);

    @PostMapping("/baseCargoOwnerMst/v1.0/getByCode")
    public RestMessage<Map<String, BaseCargoOwnerMst>> getByCode(@RequestBody Set<String> codeSet) throws RuntimeException;

    @ApiOperation(value = "根据code集合查客户列表", notes = "根据id集合查客户列表")
    @PostMapping("/baseCustomerMst/v1.0/getByCode")
    public RestMessage<List<BaseCustomerMst>> getCustomerByCode(@RequestBody Set<String> codeSet) throws RuntimeException;

    @PostMapping("/baseSupplierMst/v1.0/getByCode")
    RestMessage<List<BaseSupplierMst>> getSupplierMstByCode(@RequestBody Set<String> codeSet);

    @PostMapping("/baseSupplierMst/v1.0/getByIds")
    public RestMessage<Map<String, BaseSupplierMst>> getSupplierMstByIds(@RequestBody Set<String> idSet);

    @PostMapping("/baseCarrierMst/v1.0/findAll")
    RestMessage<List<BaseCarrierMst>> findAll(@RequestBody BaseCarrierMstRequestVO vo);

    @PostMapping("/baseCustomerMst/v1.0/customerAndSupplierPage")
    public RestMessage<Page<CustomerAndSupplierQueryVO>> customerAndSupplierPage(@RequestBody CustomerAndSupplierQueryVO queryVO);
}
