package com.dora.service;

import com.dora.dto.UserBalanceDto;
import com.dora.dto.WithdrawDto;
import com.dora.entity.UserBalance;
import com.dora.entity.UserBalanceLog;

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

/**
 * 用户余额服务接口
 */
public interface UserBalanceService {

    /**
     * 获取用户余额信息
     */
    UserBalance getUserBalance(Long userId);

    /**
     * 增加用户余额（收入）
     */
    void increaseBalance(Long userId, BigDecimal amount, String sourceType, Long sourceId, String description);

    /**
     * 减少用户余额（提现）
     */
    void decreaseBalance(Long userId, BigDecimal amount, String sourceType, Long sourceId, String description);

    /**
     * 冻结用户余额（提现申请）
     */
    void freezeBalance(Long userId, BigDecimal amount, String sourceType, Long sourceId, String description);

    /**
     * 解冻用户余额（提现失败或取消）
     */
    void unfreezeBalance(Long userId, BigDecimal amount, String sourceType, Long sourceId, String description);

    /**
     * 获取用户余额变动记录
     */
    List<UserBalanceLog> getBalanceLogs(Long userId, int page, int size);

    /**
     * 获取用户余额变动记录总数
     */
    Long getBalanceLogsCount(Long userId);

    /**
     * 验证提现条件
     */
    boolean validateWithdrawCondition(Long userId, BigDecimal amount);

    /**
     * 提交提现申请（简化版）
     */
    WithdrawDto.WithdrawResponse submitWithdrawRequest(Long userId, WithdrawDto.WithdrawRequest request);

    /**
     * 获取用户余额信息
     */
    UserBalanceDto.UserBalanceResponse getUserBalanceInfo(Long userId);

    /**
     * 获取用户余额变动记录
     */
    UserBalanceDto.BalanceLogResponse getUserBalanceLogs(Long userId, int page, int size, String changeType);

    /**
     * 获取用户余额统计信息
     */
    UserBalanceDto.UserBalanceResponse getUserBalanceStats(Long userId);

    /**
     * 获取用户余额增加明细
     */
    UserBalanceDto.IncomeDetailResponse getUserIncomeDetail(Long userId);

    /**
     * 获取提现记录列表
     */
    WithdrawDto.WithdrawListResponse getWithdrawList(Long userId, int page, int size);
} 