using Abp.Authorization;
using Abp.Localization;

namespace YGNT.QuestionLibrary.Core.Permissions
{
    public class QuestionLibraryAuthorizationProvider : AuthorizationProvider
    {
        /// <summary>
        /// 教育类别
        /// </summary>
        public const string EducationCategoryPermissionName = "EducationCategory";
        /// <summary>
        /// 年级
        /// </summary>
        public const string GradePermissionName = "Grade";
        /// <summary>
        /// 学科
        /// </summary>
        public const string DisciplinePermissionName = "Discipline";
        /// <summary>
        /// 教科书
        /// </summary>
        public const string TextbookPermissionName = "Textbook";


        public override void SetPermissions(IPermissionDefinitionContext context)
        {
            context.CreatePermission(EducationCategoryPermissionName, L(EducationCategoryPermissionName));

            context.CreatePermission(DisciplinePermissionName, L(DisciplinePermissionName));

            context.CreatePermission(TextbookPermissionName, L(TextbookPermissionName));

            context.CreatePermission(GradePermissionName, L(GradePermissionName));

        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, QuestionLibraryConsts.LocalizationSourceName);
        }
    }
}