using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace WCS.DAL
{
    /// <summary>
    /// 认证项
    /// </summary>
    public enum AuthEnum
    {
        /* 注意：枚举的值必须大于0 */
        查询 = 1000,
        权限 = 2000,
        //[Description("用户")]
        //[EnumTree(权限, new[] { 用户新增, 用户删除, 用户修改 })]
        //用户管理 = 3100, 用户新增 = 3110, 用户删除, 用户修改,
        //[Description("角色")]
        //[EnumTree(权限, new[] { 角色新增, 角色删除, 角色修改 })]
        //角色管理 = 3200, 角色新增 = 3210, 角色删除, 角色修改,
        设置 = 3000,
        调试 = 4000,
    }

    public class EnumTreeAttribute : Attribute
    {
        public EnumTreeAttribute() { }

        public EnumTreeAttribute(AuthEnum parent)
        {
            Parent = parent;
        }

        public EnumTreeAttribute(AuthEnum[] childs)
        {
            Childs = childs;
        }

        public EnumTreeAttribute(AuthEnum parent, AuthEnum[] childs)
        {
            Parent = parent;
            Childs = childs;
        }

        /// <summary>
        /// 父级
        /// </summary>
        public AuthEnum? Parent { get; set; } = null;
        /// <summary>
        /// 子级
        /// </summary>
        public AuthEnum[]? Childs { get; set; } = null;
    }
}
