
package com.tmerclub.cloud.distribution.service;

import com.tmerclub.cloud.api.auth.vo.AuthSocialVO;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.distribution.dto.AppDistributionWithdrawCashDTO;
import com.tmerclub.cloud.distribution.dto.DistributionWithdrawCashDTO;
import com.tmerclub.cloud.distribution.dto.RangeTimeDTO;
import com.tmerclub.cloud.distribution.model.DistributionWithdrawCash;
import com.tmerclub.cloud.distribution.model.EnterprisePay;
import com.tmerclub.cloud.distribution.vo.AppDistributionWithdrawCashVO;
import com.tmerclub.cloud.distribution.vo.DistributionUserVO;
import com.tmerclub.cloud.distribution.vo.DistributionWithdrawCashVO;

/**
 * 分销员提现记录
 *
 * @author cl
 * @date 2021-08-09 14:14:10
 */
public interface DistributionWithdrawCashService {

    /**
     * 分页获取分销员提现记录列表
     * @param pageDTO 分页参数
     * @param userMobile 分销员手机号
     * @param distributionWithdrawCashDTO 分销提现信息
     * @return 分销员提现记录列表分页数据
     */
    PageVO<DistributionWithdrawCashVO> page(PageDTO pageDTO, String userMobile, DistributionWithdrawCashDTO distributionWithdrawCashDTO);

    /**
     * 根据分销员提现记录id获取分销员提现记录
     *
     * @param withdrawCashId 分销员提现记录id
     * @return 分销员提现记录
     */
    DistributionWithdrawCash getByWithdrawCashId(Long withdrawCashId);

    /**
     * 保存分销员提现记录
     * @param distributionWithdrawCash 分销员提现记录
     */
    void save(DistributionWithdrawCash distributionWithdrawCash);

    /**
     * 更新分销员提现记录
     * @param distributionWithdrawCash 分销员提现记录
     */
    void update(DistributionWithdrawCash distributionWithdrawCash);

    /**
     * 根据分销员提现记录id删除分销员提现记录
     * @param withdrawCashId 分销员提现记录id
     */
    void deleteById(Long withdrawCashId);

    /**
     * 分页获取分销员提现申请记录
     * @param pageDTO 分页参数
     * @param distributionUserId 分销员id
     * @return 分销员提现申请记录
     */
    PageVO<AppDistributionWithdrawCashVO> pageByDistributionUserId(PageDTO pageDTO, Long distributionUserId);

    /**
     * 发起提现申请
     * @param distributionWithdrawCashDTO 提现金额信息
     * @param distributionUserVO 分销员信息
     * @param authSocialVO 第三方登录信息（商家转账到零钱会用到）
     */
    void apply(AppDistributionWithdrawCashDTO distributionWithdrawCashDTO, DistributionUserVO distributionUserVO, AuthSocialVO authSocialVO);

    /**
     * 根据时间区间获取用户的提现次数
     * @param rangeTimeDTO 时间范围
     * @param distributionUserId 分销员id
     * @return 分销员提现申请记录数量
     */
    Integer getCountByRangeTimeAndDistributionUserId(RangeTimeDTO rangeTimeDTO, Long distributionUserId);

    /**
     * 查看分销员总提现金额
     * @param walletId 钱包id
     * @return 总提现金额
     */
    Long getUserTotalWithdrawCash(Long walletId);

    /**
     * 添加商家转账记录
     * @param distributionWithdrawCash  提现记录
     * @param userId     提现用户id
     * @param openId     提现用户openId
     * @param status     提现状态
     */
    void enterprisePay(DistributionWithdrawCash distributionWithdrawCash, Long userId, String openId, Integer status);

    /**
     * 商家提现成功处理
     * @param enterprisePay
     */
    void distributionWithdrawToSuccess(EnterprisePay enterprisePay);

    /**
     * 商家提现失败处理
     * @param enterprisePay
     */
    void distributionWithdrawToFailed(EnterprisePay enterprisePay);
}
