
package com.kxs.user.api.feign;

import com.kxs.common.core.constant.SecurityConstants;
import com.kxs.common.core.util.R;
import com.kxs.user.api.dto.kxsapp.IntegralStatDTO;
import com.kxs.user.api.model.*;
import com.kxs.user.api.vo.kxsapp.user.RealUserInfoVO;
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.DeleteExchange;
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 RemoteKxsUserService {


	/**
	 * 通过手机号码校验验证码
	 * @param phone 电话信息
	 * @param code 验证码
	 * @param from 调用标志
	 */
	@GetExchange("/app/checkMobileCode")
	R<Boolean> checkMobileCode(@RequestParam("phone") String phone, @RequestParam("code") String code, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 有效创客校验
	 * @param userId 用户id
	 * @param from
	 * @return
	 */
	@GetExchange("/user/validUserVerify")
	boolean validUserVerify(@RequestParam("userId") Long userId, @RequestHeader(SecurityConstants.FROM) String from);
	/**
	 * 通过手机号码查询用户信息
	 * @param phone 电话信息
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/user/loadUserByPhone")
	R<KxsUser> loadUserByPhone(@RequestParam("phone") String phone, @RequestHeader(SecurityConstants.FROM) String from);
	/**
	 * 修改用户
	 *
	 * @param from       调用标志
	 * @return {@link R}<{@link Boolean}>
	 */
	@PostExchange("/user/updateById")
	void updateById(@RequestBody KxsUser kxsUser, @RequestHeader(SecurityConstants.FROM) String from);
	/**
	 * 通过创客编号查询用户信息
	 * @param userCode 电话信息
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/user/loadUserByCode")
	R<KxsUser> loadUserByCode(@RequestParam("userCode") String userCode, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过用户ID查询用户信息
	 * @param userId 用户ID
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/user/loadUserById")
	R<KxsUser> loadUserById(@RequestParam("userId") Object userId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过用户ID查询用户实名认证信息
	 * @param userId 用户ID
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/user/loadUserRealById")
	R<KxsUserReal> loadUserRealById(@RequestParam("userId") Integer userId, @RequestHeader(SecurityConstants.FROM) String from);
	/**
	 * 通过用户ID查询用户银行信息
	 * @param userId 用户ID
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/user/loadUserRealBankById")
	R<RealUserInfoVO> loadUserRealBankById(@RequestParam("userId") Integer userId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过预扣款ID查询预扣款信息
	 * @param advanceId 预扣款ID
	 * @param from 调用标志
	 * @return R
	 */
	@GetExchange("/userAdvance/loadByAdvanceId")
	R<KxsUserAdvance> loadByAdvanceId(@RequestParam("advanceId") Integer advanceId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 按 ID 删除 预扣款
	 *
	 * @param id     编号
	 * @param from 调用标志
	 * @return {@link R}<{@link Boolean}>
	 */
	@DeleteExchange("/userAdvance/removeById")
	R<Boolean> removeById(@RequestParam("id") Integer id, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 退回预扣款
	 *
	 * @param id     编号
	 * @param from 调用标志
	 * @return {@link R}<{@link Boolean}>
	 */
	@GetExchange("/userAdvance/returnAdvance")
	R<Boolean> returnAdvance(@RequestParam("id") Integer id, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 检查用户是否在自己伞下
	 *
	 * @param from        调用标志
	 * @param userId      用户 ID
	 * @param checkUserId 检查用户 ID
	 * @return {@link R}<{@link Boolean}>
	 */
	@GetExchange("/user/checkUserIsChildren")
	R<Boolean> checkUserIsChildren(@RequestParam("userId") Integer userId, @RequestParam("checkUserId") Integer checkUserId, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 用户金额变化
	 *
	 * @param userAmount 用户金额
	 * @param from       调用标志
	 * @return {@link R}<{@link Boolean}>
	 */
	@PostExchange("/userAccount/userAmountChange")
	R<Boolean> userAmountChange(@RequestBody KxsUserAmountLog userAmount, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 自动建表任务
	 *
	 * @param from       调用标志
	 */
	@GetExchange("/user-job/automaticTableCreationTasks")
	void automaticTableCreationTasks(@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 每天凌晨执行：
	 * 1.扫创客合伙人可提现额度，若有合伙人可提现额度，则扣除可提现额度，最大扣除金额=欠款总金额，扣除后减少欠款总金额，同时在前端增加扣除记录，备注为「预借款项还款」
	 * 2.扫创客盟主可提现余额，若有盟主可提现余额，则扣除可提现余额，最大扣除金额=欠款总金额，扣除后减少欠款总金额，同时在前端增加扣除记录，备注为「预借款项还款」
	 *
	 * @param from 调用标志
	 */
	@GetExchange("/user-job/userTotalDebtSub")
	void userTotalDebtSub(@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 校验支付密码
	 *
	 * @param payPwd 支付 PWD
	 * @return {@link R}
	 */
	@GetExchange("/app/checkPayPwd")
	R<Boolean> checkPayPwd(@RequestParam("payPwd") String payPwd);

	/**
	 * 积分汇算
	 *
	 */
	@PostExchange("/shareholder/integralStat")
	void integralStat(@RequestBody List<IntegralStatDTO> integralStatDTOS,@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 奖池同步交易额
	 *
	 */
	@GetExchange("/shareholder/prizePoolSynchronization")
	void prizePoolSynchronization(@RequestParam(value = "para", required = false) String para, @RequestHeader(SecurityConstants.FROM) String from);

}
