using System.ComponentModel.DataAnnotations;

namespace HoneyBox.Admin.Business.Models.User;

/// <summary>
/// 用户资金变动请求
/// </summary>
public class UserMoneyChangeRequest
{
    /// <summary>
    /// 变动类型：1-余额 2-积分 3-钻石
    /// </summary>
    [Required(ErrorMessage = "请选择变动类型")]
    [Range(1, 3, ErrorMessage = "变动类型无效")]
    public int Type { get; set; }

    /// <summary>
    /// 变动金额（正数）
    /// </summary>
    [Required(ErrorMessage = "请输入变动金额")]
    [Range(0.01, double.MaxValue, ErrorMessage = "变动金额必须大于0")]
    public decimal Amount { get; set; }

    /// <summary>
    /// 操作类型：1-增加 2-扣除
    /// </summary>
    [Required(ErrorMessage = "请选择操作类型")]
    [Range(1, 2, ErrorMessage = "操作类型无效")]
    public int Operation { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [MaxLength(200, ErrorMessage = "备注最多200个字符")]
    public string? Remark { get; set; }
}

/// <summary>
/// 资金变动类型
/// </summary>
public static class MoneyChangeType
{
    /// <summary>
    /// 余额
    /// </summary>
    public const int Balance = 1;

    /// <summary>
    /// 积分
    /// </summary>
    public const int Integral = 2;

    /// <summary>
    /// 钻石/评分
    /// </summary>
    public const int Diamond = 3;
}

/// <summary>
/// 操作类型
/// </summary>
public static class OperationType
{
    /// <summary>
    /// 增加
    /// </summary>
    public const int Add = 1;

    /// <summary>
    /// 扣除
    /// </summary>
    public const int Subtract = 2;
}
