import { DataScope, RoleLevel } from "@/store/role";

export const dataScopeDesc = {
  [DataScope.all]: "全部数据",
  [DataScope.selfLower]: "所属组织及下级组织数据",
  [DataScope.selfInner]: "所属组织内部数据",
  [DataScope.personCreate]: "个人创建数据",
};

export const dataScopeOptions = [
  { id: DataScope.all, value: dataScopeDesc[DataScope.all] },
  { id: DataScope.selfLower, value: dataScopeDesc[DataScope.selfLower] },
  { id: DataScope.selfInner, value: dataScopeDesc[DataScope.selfInner] },
  { id: DataScope.personCreate, value: dataScopeDesc[DataScope.personCreate] },
];

// 管理员的roleKey
export const adminRoleKeys = ["admin", "admin-dept", "admin-super"];

// 设置权限菜单时默认的dataScope,
// 第一级为设置者的级别
export const roleMenuDataScope = {
  [RoleLevel.tourist]: {},
  [RoleLevel.systemAdmin]: { other: DataScope.all },
  [RoleLevel.admin]: {
    503: DataScope.none,
    504: DataScope.none,
    506: DataScope.none,
    606: DataScope.none,
    607: DataScope.none,
    702: DataScope.none,
    703: DataScope.none,
    704: DataScope.none,
    710: DataScope.none,
    808: DataScope.none,
    809: DataScope.none,
    102: DataScope.selfLower,
    103: DataScope.selfLower,
    104: DataScope.selfLower,
    106: DataScope.selfLower,
    201: DataScope.selfInner,
    202: DataScope.selfInner,
    203: DataScope.selfInner,
    204: DataScope.selfInner,
    other: DataScope.all,
  },
  [RoleLevel.corps]: {
    201: DataScope.selfInner,
    202: DataScope.selfInner,
    203: DataScope.selfInner,
    204: DataScope.selfInner,
    503: DataScope.personCreate,
    506: DataScope.personCreate,
    606: DataScope.selfInner,
    607: DataScope.selfInner,
    702: DataScope.selfInner,
    703: DataScope.selfInner,
    704: DataScope.selfInner,
    other: DataScope.selfLower,
  },
  [RoleLevel.detachment1]: {
    101: DataScope.selfLower,
    102: DataScope.selfLower,
    103: DataScope.selfLower,
    104: DataScope.selfLower,
    106: DataScope.selfLower,
    301: DataScope.selfLower,
    302: DataScope.selfLower,
    303: DataScope.selfLower,
    304: DataScope.selfLower,
    501: DataScope.selfLower,
    503: DataScope.selfLower,
    504: DataScope.selfLower,
    506: DataScope.selfLower,
    507: DataScope.selfLower,
    601: DataScope.selfLower,
    701: DataScope.selfLower,
    706: DataScope.selfLower,
    707: DataScope.selfLower,
    708: DataScope.selfLower,
    710: DataScope.none,
    711: DataScope.selfLower,
    801: DataScope.selfLower,
    806: DataScope.selfLower,
    807: DataScope.selfLower,
    808: DataScope.selfLower,
    810: DataScope.selfLower,
    809: DataScope.none,
    other: DataScope.selfInner,
  },
  [RoleLevel.detachment2]: {
    302: DataScope.none,
    303: DataScope.none,
    304: DataScope.none,
    503: DataScope.personCreate,
    506: DataScope.personCreate,
    710: DataScope.none,
    809: DataScope.none,
    other: DataScope.selfInner,
  },
};
