namespace BBM.ChatGLM.Permissions
{
    public class ChatGLMPermissionDefinitionProvider : PermissionDefinitionProvider
    {
        public override void Define(IPermissionDefinitionContext context)
        {
            var group = context.GetGroup("AbpIdentity");
            var usersManagement = group.AddPermission(ChatGLMPermissions.UsersManagement.Default, L("Permission:UsersManagement"));
            usersManagement.AddChild(ChatGLMPermissions.UsersManagement.Query, L("Permission:Query"));
            usersManagement.AddChild(ChatGLMPermissions.UsersManagement.Create, L("Permission:Create"));
            usersManagement.AddChild(ChatGLMPermissions.UsersManagement.Delete, L("Permission:Delete"));
            usersManagement.AddChild(ChatGLMPermissions.UsersManagement.Update, L("Permission:Update"));
            usersManagement.AddChild(ChatGLMPermissions.UsersManagement.Chat, L("Permission:Chat"));
            usersManagement.AddChild(ChatGLMPermissions.UsersManagement.ResetPassword, L("Permission:ResetPassword"));

            var promptWordManagement = group.AddPermission(ChatGLMPermissions.PromptWordManagement.Default, L("Permission:PromptWordManagement"));
            promptWordManagement.AddChild(ChatGLMPermissions.PromptWordManagement.Query, L("Permission:Query"));
            promptWordManagement.AddChild(ChatGLMPermissions.PromptWordManagement.Create, L("Permission:Create"));
            promptWordManagement.AddChild(ChatGLMPermissions.PromptWordManagement.Delete, L("Permission:Delete"));
            promptWordManagement.AddChild(ChatGLMPermissions.PromptWordManagement.Update, L("Permission:Update"));

            var promptWordTypeManagement = group.AddPermission(ChatGLMPermissions.PromptWordTypeManagement.Default, L("Permission:PromptWordTypeManagement"));
            promptWordTypeManagement.AddChild(ChatGLMPermissions.PromptWordTypeManagement.Query, L("Permission:Query"));
            promptWordTypeManagement.AddChild(ChatGLMPermissions.PromptWordTypeManagement.Create, L("Permission:Create"));
            promptWordTypeManagement.AddChild(ChatGLMPermissions.PromptWordTypeManagement.Delete, L("Permission:Delete"));
            promptWordTypeManagement.AddChild(ChatGLMPermissions.PromptWordTypeManagement.Update, L("Permission:Update"));
        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<ChatGLMResource>(name);
        }
    }
}