using System.ComponentModel.DataAnnotations;
namespace AmtScanner.Api.Models;
///
/// 系统菜单
///
public class Menu
{
[Key]
public int Id { get; set; }
///
/// 父菜单 ID(null 表示顶级菜单)
///
public int? ParentId { get; set; }
///
/// 路由名称
///
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
///
/// 路由路径
///
[Required]
[MaxLength(200)]
public string Path { get; set; } = string.Empty;
///
/// 组件路径
///
[MaxLength(200)]
public string? Component { get; set; }
///
/// 菜单标题(i18n key 或直接文本)
///
[MaxLength(200)]
public string? Title { get; set; }
///
/// 图标
///
[MaxLength(100)]
public string? Icon { get; set; }
///
/// 排序(数字越小越靠前)
///
public int Sort { get; set; } = 0;
///
/// 是否隐藏
///
public bool IsHide { get; set; } = false;
///
/// 是否缓存(keep-alive)
///
public bool KeepAlive { get; set; } = false;
///
/// 外链地址
///
[MaxLength(500)]
public string? Link { get; set; }
///
/// 是否 iframe 嵌入
///
public bool IsIframe { get; set; } = false;
///
/// 是否隐藏标签页
///
public bool IsHideTab { get; set; } = false;
///
/// 角色限制(JSON 数组,如 ["R_SUPER", "R_ADMIN"])
///
[MaxLength(500)]
public string? Roles { get; set; }
///
/// 按钮权限列表(JSON 数组)
///
[MaxLength(1000)]
public string? AuthList { get; set; }
///
/// 创建时间
///
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
///
/// 父菜单
///
public Menu? Parent { get; set; }
///
/// 子菜单
///
public ICollection