export const enum SKU_ID_TYPS  {
  "saas_basic_try" = 1, // 基础试用
  "saas_advanced_try" , //高级试用
  "saas_vip_try" , // 尊享试用
  "saas_basic",
  "saas_advanced",
  "saas_vip",
  "saas_personal_try", //个人版
  "saas_personal"
};
export interface UserInfo {
  edition?: EditionInfo;
  type?: TanantType;
  userId?: number;
  userName?: string;
  tenantId?: number;
  tenantName?: string;
  shareCount?: number;
  screenCount?: number;
  role?: RoleType;
  bannedModules?: string[];
  exp?: string;
  loadingPage?: string;
  originExp?: number;
  skuId?: SKU_ID_TYPS;
  userType?: string;
  isAccountOwner?: boolean;
  isImportExpired?: boolean;
  isRenew?: boolean;
}

export interface UserItem {
  id: number;
}

export interface TenantItem {
  id: number;
  name: string;
}

export enum UserType {
  'MAIN_USER' = '主用户',
  'SUB_USER' = '子用户',
  'COLLABORATORS' = '协作者'
}

export type UserState = Readonly<{
  userInfo: UserInfo;
  tenants: TenantItem[];
  nonentityModule: number[];
  users: {
    search: string;
    page: number;
    pageSize: number;
    list: UserItem[];
  };
  isAdmin: boolean;
  isRoot: boolean;
  isRenew: boolean;
  isPerson: boolean;
  authority: string[];
  userType?: UserType;
}>;
// 1,2,3试用 4,5,6正式 7个人试用 8个人
export type EditionListType = {
  1: ['SaaS 试用版', 'saas_basic'];
  2: ['SaaS 高级版', 'saas_advanced'];
  3: ['SaaS 尊享版', 'saas_vip'];
  4: ['SaaS 基础版', 'saas_basic'];
  5: ['SaaS 高级版', 'saas_advanced'] | ['Renew 企业版', 'saas_advanced'];
  6: ['SaaS 尊享版', 'saas_vip'] | ['Renew 开发版', 'saas_vip'];
  7: ['个人版', 'saas_personal'];
  8: ['个人版', 'saas_personal'];
};

export type EditionName = EditionListType[keyof EditionListType][0];

export type EditionType = EditionListType[keyof EditionListType][1];

export type TanantListType = {
  education: '基础版';
  community: '开发者版';
  enterprise: '企业版';
  lifelong: '开发者版';
};

export type TanantType = keyof TanantListType;

export type TanantName = TanantListType[keyof TanantListType];

export enum RoleType {
  BASIC,
  ADMIN,
  ROOT
}

export enum SupportType {
  SUPPORT_NONE,
  SUPPORT_ALL,
  SUPPORT_PART
}

export interface EditionInfo {
  id: EditionType;
  name: EditionName;
  screenCount: number;
  shareCount: number;
  supportAnimation: boolean;
  supportConstant: SupportType;
  supportMobile: boolean;
  supportSpaceship: boolean;
  supportTheme: boolean;
  createdAt: string;
  updatedAt: string;
  trialChanged: number;
  constantIds: number[];
  edition: 1 | 2 | 3; //1-3 代表基础班 -> 尊享版
  expiredAt: string;
}

export type ResultSaasProductionType = <T extends keyof EditionListType>(skuId: T, isRenew: boolean) => EditionListType[T];

export type ResultLocalProductionType = <T extends keyof TanantListType>(type: T) => TanantListType[T];
