package com.prolog.cs.biz.inbound.remote;

import com.prolog.cs.basic.chain.model.CompanyScope;
import com.prolog.cs.basic.chain.model.cargo.BaseCargoOwnerMst;
import com.prolog.cs.basic.chain.model.cargo.vo.CargoOwnerLicenseQueryVO;
import com.prolog.cs.basic.chain.model.customer.BaseCustomerMst;
import com.prolog.cs.basic.chain.model.customer.vo.BaseCustomerMstRealatedVO;
import com.prolog.cs.basic.chain.model.customer.vo.BaseCustomerMstRequestVO;
import com.prolog.cs.basic.chain.model.supplier.BaseSupplierMst;
import com.prolog.cs.basic.chain.service.supplier.vo.BaseSupplierMstRealatedVO;
import com.prolog.framework.common.message.RestMessage;
import io.swagger.annotations.ApiOperation;
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;
import java.util.Map;
import java.util.Set;

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

	/**
	 * 校验供应商的《药品生产许可证》证照效期和委托书效期 @ApiOperation("校验供应商的证件,效期")
	 * 
	 * @ApiImplicitParam(value =
	 *                         "[{'delegationPartyId':'供应商id','row':'来源唯一关联id','enterpriseId':'企业id'},{}...]")
	 */
	@PostMapping("baseSupplierMst/v1.0/healthLicense/vaildate")
	public RestMessage<?> healthLicenseVaildate(@RequestBody List<Map<String, Object>> mapList);

	/**
	 * 批量查询货主信息
	 *
	 * @return 货主信息
	 */
	@PostMapping("/baseCargoOwnerMst/v1.0/getByIds")
	public RestMessage<Map<String,BaseCargoOwnerMst>> getByIds(@RequestBody Set<String> idSet);

	/**
	 * 批量查询货主信息编码
	 *
	 * @return 货主信息
	 */
	@PostMapping("/baseCargoOwnerMst/v1.0/getByCode")
	public RestMessage<Map<String,BaseCargoOwnerMst>> getByCode(@RequestBody Set<String> codeSet);

	/**
	 * 批量查询供应商信息编码
	 *
	 * @return 货主信息
	 */
	@PostMapping("/baseSupplierMst/v1.0/getByCode")
	public RestMessage<List<BaseSupplierMst>> getBySupperCode(@RequestBody Set<String> codeSet);

	/**
	 * 批量查询客户信息编码
	 *
	 * @return 货主信息
	 */
	@PostMapping("/baseCustomerMst/v1.0/getByCode")
	public RestMessage<List<BaseCustomerMst>> getByCustomerCode(@RequestBody Set<String> codeSet);


	//客户条件查询全部(基础主表)
	@PostMapping("/baseCustomerMst/v1.0/findAll")
	public RestMessage<List<BaseCustomerMst>> findAll(@RequestBody(required = false) BaseCustomerMstRequestVO request);

	//@ApiOperation(value = "根据id集合查货主列表", notes = "根据id集合查货主列表")
	@PostMapping("/baseSupplierMst/v1.0/getByIds")
	public RestMessage<Map<String, BaseSupplierMst>> getSupplierByIds(@RequestBody Set<String> idSet);

	/**
	 * 主键id查询单条,供应商主键id查询(基础主表)
	 */
	@GetMapping("/baseSupplierMst/v1.0/findOne")
	public RestMessage<BaseSupplierMst> findOne(@RequestParam(value = "id", required = true) String id);


	/**
	 * 主键id查询单条,客户主键id查询(基础主表)
	 */
	@GetMapping("/baseCustomerMst/v1.0/findOne")
	public RestMessage<BaseCustomerMst> findCustomerMstOne(@RequestParam(value = "id", required = true) String id);


	/**
	 * 主键id查询单条,供应商主键id查询(基础主表)
	 */
	@GetMapping("/baseCargoOwnerMst/v1.0/infoById")
	public RestMessage<Map<String, Object>> getCargoOwnerById(@RequestParam(value = "cargoOwnerId", required = true) String cargoOwnerId);
	
    //客户主键id查询(包含所有的属性信息)
    @GetMapping("/baseCustomerMst/v1.0/findWithAttr")
    public RestMessage<BaseCustomerMstRealatedVO> findCustomerWithAttr(@RequestParam(value = "id", required = true) String id);	
    
    //供应商主键id查询(包含所有的属性信息)
    @GetMapping("/baseSupplierMst/v1.0/findWithAttr")
    public RestMessage<BaseSupplierMstRealatedVO> findSupplierWithAttr(@RequestParam(value = "id", required = true) String id);
    
	/**
	 * 校验货主的证照是否过期
	 */
//	@ApiOperation(value = "校验货主的证照是否过期", notes = "校验货主的证照是否过期")
	@PostMapping("/baseCargoOwnerMst/v1.0/vaildate-license")
	public RestMessage<Object> vaildateLicense(@RequestBody CargoOwnerLicenseQueryVO licenseQueryVO);
    
	/**
	 * 校验供应商所有证照效期
	 */
//	@ApiOperation("校验供应商所有证照效期")
//	@ApiImplicitParam(value = "{'supplierId':'供应商id','licenseName':'证照名称','enterpriseId':'企业id'}")
	@PostMapping("/baseSupplierMst/v1.0/healthLicense/vaildateAll")
	public RestMessage<?> healthLicenseVaildateAll(@RequestBody Map<String, Object> queryMap);
	
	/**
	 * 校验客户所有证照效期
	 */
//	@ApiOperation("校验客户所有证照效期")
//	@ApiImplicitParam(value = "{'customerId':'客户id','licenseName':'证照名称','enterpriseId':'企业id'}")
	@PostMapping("/baseCustomerMst/v1.0/healthLicense/vaildateAll")
	public RestMessage<?> healthLicenseVaildateAll2(@RequestBody Map<String, Object> queryMap);
	
	/**
	 * 校验货主的经营资质(匹配商品大类)
	 */
//	@ApiOperation(value = "校验货主的经营范围", notes = "校验货主的证照是否过期")
//	@ApiImplicitParam(value = "数据示例: {'cargoOwnerId':'','queryMap':[{'itemId':'商品id','itemCategoryCode':'商品大类编码','refId':'关联id','flag':true/false,'message':''},{}]};响应也是这个")
	@PostMapping("/baseCargoOwnerMst/v1.0/vaildate-scope")
	public RestMessage<Object> vaildateScope(@RequestBody Map<String, Object> queryMap);

	/**
	 * 根据单位id查询三种经营范围的数据
	 */
	@ApiOperation(value = "根据单位id查询三种经营范围的数据")
	@GetMapping("/companyScope/findByCompanyId")
	public RestMessage<List<CompanyScope>> findByCompanyId(@RequestParam(value = "companyId", required = true) String companyId);

	/**
	 * @author fr 2021-02-26 根据id集合查货主列表
	 * @return
	 */
	@ApiOperation(value = "根据id集合查货主列表", notes = "根据id集合查货主列表")
	@PostMapping("/baseSupplierMst/v1.0/getByIds")
	public RestMessage<Object> getSupplierMstByIds(@RequestBody Set<String> idSet) throws RuntimeException;

}
