using System.ComponentModel.DataAnnotations;

namespace HoneyBox.Admin.Models.Menu;

/// <summary>
/// 创建菜单请求
/// </summary>
public class CreateMenuRequest
{
    /// <summary>
    /// 父菜单ID，0表示顶级菜单
    /// </summary>
    public long ParentId { get; set; } = 0;

    /// <summary>
    /// 菜单名称
    /// </summary>
    [Required(ErrorMessage = "菜单名称不能为空")]
    [MaxLength(50, ErrorMessage = "菜单名称最多50个字符")]
    public string Name { get; set; } = null!;

    /// <summary>
    /// 路由路径
    /// </summary>
    [MaxLength(200, ErrorMessage = "路由路径最多200个字符")]
    public string? Path { get; set; }

    /// <summary>
    /// 组件路径
    /// </summary>
    [MaxLength(200, ErrorMessage = "组件路径最多200个字符")]
    public string? Component { get; set; }

    /// <summary>
    /// 图标
    /// </summary>
    [MaxLength(100, ErrorMessage = "图标最多100个字符")]
    public string? Icon { get; set; }

    /// <summary>
    /// 菜单类型：1目录 2菜单 3按钮
    /// </summary>
    [Range(1, 3, ErrorMessage = "菜单类型必须是1(目录)、2(菜单)或3(按钮)")]
    public byte MenuType { get; set; } = 1;

    /// <summary>
    /// 权限标识
    /// </summary>
    [MaxLength(100, ErrorMessage = "权限标识最多100个字符")]
    public string? Permission { 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;

    /// <summary>
    /// 是否外链
    /// </summary>
    public bool IsExternal { get; set; } = false;

    /// <summary>
    /// 是否缓存
    /// </summary>
    public bool IsCache { get; set; } = true;
}
