
package com.kxs.product.api.feign;

import com.kxs.common.core.constant.SecurityConstants;
import com.kxs.common.core.util.R;
import com.kxs.product.api.model.KxsBrand;
import com.kxs.product.api.model.KxsMachine;
import com.kxs.product.api.model.KxsMachineCirculationLog;
import com.kxs.product.api.model.KxsTicket;
import com.kxs.product.api.vo.kxsapp.shop.ShopOrderGoodsUserVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.PostExchange;

import java.util.List;

/**
 * @author Lxq
 * @date 2021/6/22
 */
public interface RemoteKxsProductService {

	/**
	 * 查询品牌
	 * @param id id
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/brand/loadByBrand")
	R<KxsBrand> loadByBrand(@RequestParam("id") Integer id, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过sn查询券码信息
	 * @param sn 券码
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/ticket/loadTicketBySn")
	R<KxsTicket> loadTicketBySn(@RequestParam("sn") String sn, @RequestHeader(SecurityConstants.FROM) String from);


	/**
	 * 更新券
	 *
	 * @param ticket 券码
	 * @param from   调用标志
	 * @return {@link R}<{@link KxsTicket}>
	 */
	@PostExchange("/ticket/updateByTicket")
	R<Boolean> updateByTicket(@RequestBody KxsTicket ticket, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过sn查询机具信息
	 * @param sn 券码
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/machine/loadMachineBySn")
	R<KxsMachine> loadMachineBySn(@RequestParam("sn") String sn, @RequestHeader(SecurityConstants.FROM) String from);


	/**
	 * 更新机具
	 *
	 * @param machine 机具
	 * @param from    调用标志
	 * @return {@link R}<{@link Boolean}>
	 */
	@PostExchange("/machine/updateByMachine")
	R<Boolean> updateByMachine(@RequestBody KxsMachine machine, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 按 ID 查询机具
	 *
	 * @param machineId 机具 ID
	 * @param from      调用标志
	 * @return {@link R}<{@link KxsMachine}>
	 */
	@GetExchange("/machine/loadMachineById")
	R<KxsMachine> loadMachineById(@RequestParam("id") Integer machineId, @RequestHeader(SecurityConstants.FROM) String from);


	/**
	 * 查询机具循环记录
	 *
	 * @param machineId 机具 ID
	 * @return {@link R}<{@link KxsMachine}>
	 */
	@GetExchange("/machineCirculationLog/loadCirculationLogByMachineId")
	R<KxsMachineCirculationLog> loadCirculationLogByMachineId(@RequestParam("machineId") Integer machineId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 可回收机具数量
	 *
	 * @param from   调用标志
	 * @param userId 用户 ID
	 * @return {@link R}<{@link Integer}>
	 */
	@GetExchange("/machine/loadRecoverableData")
	R<Integer> loadRecoverableData(@RequestParam("userId") Long userId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 循环过期机具添加预扣款
	 *
	 * @param from  调用标志
	 * @param param 调用参数
	 */
	@GetExchange("/product-job/recycleMachineSchedule")
	void recycleMachineSchedule(@RequestParam("param") String param, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 查询指定时间区间的电签大机券订单
	 *
	 * @param from  调用标志
	 * @param startTime 开始时间
	 * @param endTime 结束时间
	 */
	@GetExchange("/shop/getDateBetweenOrders")
	R<List<ShopOrderGoodsUserVO>> getDateBetweenOrders(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime, @RequestHeader(SecurityConstants.FROM) String from);

}
