using HoneyBox.Admin.Business.Models;
using HoneyBox.Admin.Business.Models.User;

namespace HoneyBox.Admin.Business.Services.Interfaces;

/// <summary>
/// 用户业务服务接口
/// </summary>
public interface IUserBusinessService
{
    #region 用户列表和详情

    /// <summary>
    /// 获取用户列表（含消费统计）
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>分页用户列表</returns>
    Task<PagedResult<UserListResponse>> GetUserListAsync(UserListRequest request);

    /// <summary>
    /// 获取用户详情
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>用户详情</returns>
    Task<UserDetailResponse?> GetUserDetailAsync(int userId);

    #endregion

    #region 资金变动

    /// <summary>
    /// 变更用户资金（余额/积分/钻石）
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="request">变动请求</param>
    /// <param name="operatorId">操作员ID</param>
    /// <returns>是否成功</returns>
    Task<bool> ChangeUserMoneyAsync(int userId, UserMoneyChangeRequest request, int operatorId);

    #endregion

    #region 状态管理

    /// <summary>
    /// 设置用户状态（封号/解封）
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="status">状态：1-正常 0-禁用</param>
    /// <returns>是否成功</returns>
    Task<bool> SetUserStatusAsync(int userId, int status);

    /// <summary>
    /// 设置测试账号标识
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="isTest">是否测试账号：0-否 1-是</param>
    /// <returns>是否成功</returns>
    Task<bool> SetTestAccountAsync(int userId, int isTest);

    /// <summary>
    /// 清空用户手机号
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>是否成功</returns>
    Task<bool> ClearMobileAsync(int userId);

    /// <summary>
    /// 清空用户微信绑定（生成新的随机openid）
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>是否成功</returns>
    Task<bool> ClearWeChatAsync(int userId);

    #endregion

    #region 赠送功能

    /// <summary>
    /// 赠送优惠券给用户
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="request">赠送请求</param>
    /// <returns>是否成功</returns>
    Task<bool> GiftCouponAsync(int userId, GiftCouponRequest request);

    /// <summary>
    /// 赠送卡牌给用户
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="request">赠送请求</param>
    /// <returns>是否成功</returns>
    Task<bool> GiftCardAsync(int userId, GiftCardRequest request);

    #endregion

    #region 统计功能

    /// <summary>
    /// 获取用户盈亏统计
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="dateRange">日期范围（可选）</param>
    /// <returns>盈亏统计</returns>
    Task<UserProfitLossResponse> GetUserProfitLossAsync(int userId, DateRange? dateRange);

    /// <summary>
    /// 获取下级用户列表
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="page">页码</param>
    /// <param name="pageSize">每页数量</param>
    /// <returns>下级用户列表</returns>
    Task<PagedResult<UserListResponse>> GetSubordinateUsersAsync(int userId, int page, int pageSize);

    #endregion

    #region 用户详情相关

    /// <summary>
    /// 获取用户盒柜列表
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="query">查询参数</param>
    /// <returns>盒柜列表</returns>
    Task<PagedResult<UserBoxItem>> GetUserBoxAsync(int userId, UserBoxQuery query);

    /// <summary>
    /// 获取用户订单列表
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="query">查询参数</param>
    /// <returns>订单列表</returns>
    Task<PagedResult<UserOrderItem>> GetUserOrdersAsync(int userId, UserOrderQuery query);

    /// <summary>
    /// 获取用户余额流水明细
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="query">查询参数</param>
    /// <returns>流水明细列表</returns>
    Task<PagedResult<MoneyDetailItem>> GetUserMoneyDetailAsync(int userId, MoneyDetailQuery query);

    /// <summary>
    /// 获取用户积分流水明细
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="query">查询参数</param>
    /// <returns>流水明细列表</returns>
    Task<PagedResult<MoneyDetailItem>> GetUserIntegralDetailAsync(int userId, MoneyDetailQuery query);

    /// <summary>
    /// 获取用户哈尼券流水明细
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="query">查询参数</param>
    /// <returns>流水明细列表</returns>
    Task<PagedResult<MoneyDetailItem>> GetUserMoney2DetailAsync(int userId, MoneyDetailQuery query);

    /// <summary>
    /// 获取用户钻石流水明细（已废弃，请使用GetUserMoney2DetailAsync）
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="query">查询参数</param>
    /// <returns>流水明细列表</returns>
    Task<PagedResult<MoneyDetailItem>> GetUserScoreDetailAsync(int userId, MoneyDetailQuery query);

    /// <summary>
    /// 获取用户IP登录历史
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="page">页码</param>
    /// <param name="pageSize">每页数量</param>
    /// <returns>IP登录历史列表</returns>
    Task<PagedResult<IpLogItem>> GetUserIpLogsAsync(int userId, int page, int pageSize);

    #endregion

    #region 统计和操作相关

    /// <summary>
    /// 获取用户邀请统计列表
    /// </summary>
    /// <param name="query">查询参数</param>
    /// <returns>邀请统计列表</returns>
    Task<PagedResult<InviteStatsItem>> GetInviteStatsAsync(InviteStatsQuery query);

    /// <summary>
    /// 获取用户登录统计
    /// </summary>
    /// <param name="query">查询参数</param>
    /// <returns>登录统计数据</returns>
    Task<LoginStatsResponse> GetLoginStatsAsync(LoginStatsQuery query);

    /// <summary>
    /// 获取用户盈亏列表
    /// </summary>
    /// <param name="query">查询参数</param>
    /// <returns>盈亏列表</returns>
    Task<PagedResult<ProfitLossItem>> GetProfitLossListAsync(ProfitLossListQuery query);

    /// <summary>
    /// 绑定用户手机号
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="mobile">手机号</param>
    /// <returns>是否成功</returns>
    Task<bool> BindMobileAsync(int userId, string mobile);

    /// <summary>
    /// 重置用户签到数据
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>是否成功</returns>
    Task<bool> ResetUserSignAsync(int userId);

    /// <summary>
    /// 清空用户UID
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>是否成功</returns>
    Task<bool> ClearUidAsync(int userId);

    #endregion
}
