package com.hfkj.service.spread;

import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.BsUserSpreadAccount;
import com.hfkj.sysenum.spread.UserSpreadAccountRecordSourceTypeEnum;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @className: BsUserSpreadAccountService
 * @author: HuRui
 * @date: 2025/3/31
 **/
public interface BsUserSpreadAccountService {

    /**
     * 创建数据
     * @param userId
     */
    void create(Long userId,String userPhone);

    /**
     * 修改数据
     * @param data
     */
    void update(BsUserSpreadAccount data);

    /**
     * 冻结账户
     * @param userId
     */
    void freezeUserSpread(Long userId);

    /**
     * 解除冻结
     * @param userId
     */
    void unfreezeUserSpread(Long userId);

    /**
     * 查询详情
     * @param userId
     * @return
     */
    BsUserSpreadAccount getDetailByUser(Long userId);

    /**
     * 查询列表
     * @param param
     * @return
     */
    List<BsUserSpreadAccount> getList(Map<String,Object> param);

    /**
     * 提现
     * @param userId 用户id
     * @param amount 提现金额
     */
    JSONObject withdraw(Long userId, String openId,BigDecimal amount) throws Exception;

    /**
     * 取消提现
     * @param orderNo 提现单号
     * @return
     */
    void cancelWithdraw(String orderNo) throws Exception;

    /**
     * 增加余额
     * @param userId    用户id
     * @param amount    金额
     */
    void increase(Long userId, BigDecimal amount, UserSpreadAccountRecordSourceTypeEnum sourceType, Map<String, Object> otherParam) throws Exception;

    /**
     * 扣除余额
     * @param userId        用户id
     * @param amount         金额
     * @param otherParam     其他参数
     */
    void minus(Long userId, BigDecimal amount, UserSpreadAccountRecordSourceTypeEnum sourceType, Map<String, Object> otherParam) throws Exception;


}
