using System.ComponentModel.DataAnnotations;

namespace HoneyBox.Admin.Models.Role;

/// <summary>
/// 创建角色请求
/// </summary>
public class CreateRoleRequest
{
    /// <summary>
    /// 角色名称
    /// </summary>
    [Required(ErrorMessage = "角色名称不能为空")]
    [MaxLength(50, ErrorMessage = "角色名称最多50个字符")]
    public string Name { get; set; } = null!;

    /// <summary>
    /// 角色编码
    /// </summary>
    [Required(ErrorMessage = "角色编码不能为空")]
    [MaxLength(50, ErrorMessage = "角色编码最多50个字符")]
    [RegularExpression(@"^[a-zA-Z][a-zA-Z0-9_]*$", ErrorMessage = "角色编码必须以字母开头，只能包含字母、数字和下划线")]
    public string Code { get; set; } = null!;

    /// <summary>
    /// 角色描述
    /// </summary>
    [MaxLength(500, ErrorMessage = "角色描述最多500个字符")]
    public string? Description { get; set; }

    /// <summary>
    /// 排序号
    /// </summary>
    public int SortOrder { get; set; } = 0;

    /// <summary>
    /// 状态：0禁用 1启用
    /// </summary>
    [Range(0, 1, ErrorMessage = "状态必须是0(禁用)或1(启用)")]
    public byte Status { get; set; } = 1;
}
