using Furion.DatabaseAccessor;
using Furion.JsonSerialization;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;

namespace YBEE.EQM.Core.SeedData;

/// <summary>
/// 角色种子
/// </summary>
public class SysRoleSeedData : IEntitySeedData<SysRole>
{
    /// <summary>
    /// 种子数据
    /// </summary>
    /// <param name="dbContext"></param>
    /// <param name="dbContextLocator"></param>
    /// <returns></returns>
    public IEnumerable<SysRole> HasData(DbContext dbContext, Type dbContextLocator)
    {
        return new[]
        {
            new SysRole 
            { 
                Id = 1, Name = "超级管理员", SysRoleGroupId = 1, RoleType = RoleType.SUPER_ADMIN, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false,
                RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages = new(){ EducationStage.PRIMARY_SCHOOL_STAGE, EducationStage.JUNIOR_HIGH_SCHOOL_STAGE, EducationStage.SENIOR_HIGH_SCHOOL_STAGE, EducationStage.PRESCHOOL_STAGE } })
            },

            new SysRole { Id = 2, Name = "管理员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
            new SysRole { Id = 3, Name = "小学特殊学生审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages = new(){ EducationStage.PRIMARY_SCHOOL_STAGE } }) },
            new SysRole { Id = 4, Name = "小学缺测替补审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages = new(){ EducationStage.PRIMARY_SCHOOL_STAGE } }) },

            new SysRole { Id = 5, Name = "学区结果应用人员", SysRoleGroupId = 3, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
            
            new SysRole { Id = 6, Name = "学校管理人员", SysRoleGroupId = 4, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
            new SysRole { Id = 7, Name = "数据上报人员", SysRoleGroupId = 4, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },
            new SysRole { Id = 8, Name = "结果应用人员", SysRoleGroupId = 4, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },

            new SysRole { Id = 9, Name = "初中特殊学生审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages = new(){ EducationStage.JUNIOR_HIGH_SCHOOL_STAGE } }) },
            new SysRole { Id = 10, Name = "初中缺测替补审核员", SysRoleGroupId = 2, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false, RoleDataScope = JSON.Serialize(new RoleDataScope(){ EducationStages = new(){ EducationStage.JUNIOR_HIGH_SCHOOL_STAGE } }) },
            

            new SysRole { Id = 11, Name = "双向细目表编制员", SysRoleGroupId = 5, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },            
            new SysRole { Id = 12, Name = "学科问题建议编写员", SysRoleGroupId = 5, RoleType = RoleType.NORMAL, CreateSysUserId = 1, CreateTime = DateTime.Now, Status = CommonStatus.ENABLE, IsDeleted = false },            
        };
    }
}