namespace HoneyBox.Admin.Business.Models.User;

/// <summary>
/// 流水明细查询请求
/// </summary>
public class MoneyDetailQuery : PagedRequest
{
    /// <summary>
    /// 变动类型
    /// </summary>
    public int? Type { get; set; }

    /// <summary>
    /// 变动方向：add增加，sub减少
    /// </summary>
    public string? ChangeType { get; set; }

    /// <summary>
    /// 变动说明关键字
    /// </summary>
    public string? Content { get; set; }

    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
}

/// <summary>
/// 流水明细项
/// </summary>
public class MoneyDetailItem
{
    /// <summary>
    /// 记录ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 变动金额（正数为增加，负数为减少）
    /// </summary>
    public decimal ChangeMoney { get; set; }

    /// <summary>
    /// 变动后余额
    /// </summary>
    public decimal Money { get; set; }

    /// <summary>
    /// 变动类型
    /// </summary>
    public int Type { get; set; }

    /// <summary>
    /// 变动说明
    /// </summary>
    public string Content { get; set; } = null!;

    /// <summary>
    /// 其他信息
    /// </summary>
    public string? Other { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime Addtime { get; set; }

    /// <summary>
    /// 变动方向文本
    /// </summary>
    public string ChangeTypeText => ChangeMoney >= 0 ? "增加" : "减少";
}

/// <summary>
/// IP登录历史查询请求
/// </summary>
public class IpLogQuery : PagedRequest
{
    /// <summary>
    /// IP地址
    /// </summary>
    public string? Ip { get; set; }

    /// <summary>
    /// 开始时间
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// 结束时间
    /// </summary>
    public DateTime? EndTime { get; set; }
}

/// <summary>
/// IP登录历史项
/// </summary>
public class IpLogItem
{
    /// <summary>
    /// 记录ID
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    public int UserId { get; set; }

    /// <summary>
    /// 登录日期
    /// </summary>
    public DateOnly LoginDate { get; set; }

    /// <summary>
    /// 登录时间
    /// </summary>
    public DateTime? LoginTime { get; set; }

    /// <summary>
    /// 最后登录时间
    /// </summary>
    public DateTime? LastLoginTime { get; set; }

    /// <summary>
    /// 设备类型
    /// </summary>
    public string? Device { get; set; }

    /// <summary>
    /// 登录IP
    /// </summary>
    public string? Ip { get; set; }

    /// <summary>
    /// 登录位置
    /// </summary>
    public string? Location { get; set; }
}
