using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Atomx.Common.Entities
{
    /// <summary>
	/// 菜单数据,可用于后台菜单和其他菜单，通过Type约定
	/// </summary>
    [Table("Menus")]
	public class Menu
    {
        /// <summary>
        /// 分类ID
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 分类类型,1-管理后台系统
        /// </summary>
        public int Type { get; set; }

        /// <summary>
        /// 上级分类ID
        /// </summary>
        public long ParentId { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 分类图标
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string Icon { get; set; } = string.Empty;

        /// <summary>
        /// 菜单分组，针对折叠菜单效果
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string Key { get; set; } = string.Empty;

        /// <summary>
        /// 菜单链接的URL
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string Url { get; set; } = string.Empty;

        /// <summary>
        /// 权限代码
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string Code { get; set; } = string.Empty;

        /// <summary>
        /// 是否外链接
        /// </summary>
        public bool IsLink { get; set; }

        /// <summary>
        /// 是否可用
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 层级深度
        /// </summary>
        public int Depth { get; set; }

        /// <summary>
        /// 层级路径
        /// </summary>
        [Column(TypeName = "varchar(100)")]
        public string Path { get; set; } = string.Empty;

        /// <summary>
        /// 排序
        /// </summary>
        public int DisplayOrder { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column(TypeName = "timestamptz")]

        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column(TypeName = "timestamptz")]
        public DateTime? UpdateTime { get; set; }
    }
}
