using SqlSugar;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XPrintServer.DataModel.Models
{
    /// <summary>
    /// 菜单表
    /// </summary>
    [SugarIndex("idx_ids", nameof(ParentId), OrderByType.Desc)]
    [SugarIndex("idx_menu_name", nameof(MenuName), OrderByType.Desc)]
    //[SplitTable(SplitType.Year)]//按年分表 （自带分表支持 年、季、月、周、日）
    //[SugarTable("menu_{year}{month}{day}")]//3个变量必须要有，这么设计为了兼容开始按年，后面改成按月、按日
    public class Menu
    {
        /// <summary>
        /// Desc:Id
        /// Default:
        /// Nullable:False
        /// </summary>           
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键Id")]
        public Guid Id { get; set; }

        [SugarColumn(IsNullable = true, DefaultValue = null, ColumnDescription = "父级Id,Null则为顶级菜单")]
        public Guid? ParentId { get; set; } = null;

        /// <summary>
        /// Desc:菜单名称
        /// Default:
        /// Nullable:False
        /// </summary>    
        [SugarColumn(IsNullable = false, ColumnDescription = "菜单名称")]
        public string MenuName { get; set; } = null!;


        /// <summary>
        /// Desc:路由名称
        /// Default:
        /// Nullable:False
        /// </summary>    
        [SugarColumn(IsNullable = false, ColumnDescription = "路由名称")]
        public string RouteName { get; set; } = null!;


        /// <summary>
        /// Desc:组件路径
        /// Default:
        /// Nullable:False
        /// </summary>    
        [SugarColumn(IsNullable = false, ColumnDescription = "组件路径")]
        public string ComponentPath { get; set; } = null!;


        /// <summary>
        /// Desc:是否启用
        /// Default:
        /// Nullable:False
        /// </summary>    
        [SugarColumn(IsNullable = false, ColumnDescription = "是否启用")]
        public bool IsActive { get; set; } = false;

        ///// <summary>
        ///// 分表字段 在插入的时候会根据这个字段插入哪个表，在更新删除的时候用这个字段找出相关表
        ///// </summary>
        //[SplitField] //分表字段 在插入的时候会根据这个字段插入哪个表，在更新删除的时候用这个字段找出相关表
        //public DateTime CreateTime { get; set; }
    }
}
