export enum Platform {
  WEB = 'web',
  MINIPROGRAM = 'miniprogram',
}

// 登录页来源
export enum StorageMode {
  SESSION = 'session',
}

// 登录页来源
export enum LoginSource {
  PORTAL = 'portal',
  APIS = 'apis',
  APP = 'app',
}

export enum AlginMode {
  LEFT = 'left',
  CENTER = 'center',
  RIGHT = 'right',
}

// 登录源类型
export enum LoginMethodType {
  PASSWORD = 'password',
  SMS = 'sms',
  AUTH = 'auth',
  MINIPROGRAM_PHONE = 'miniprogram_phone',
  PORTAL_WECOM = 'portal_wecom',
}

// 登录源
export interface LoginMethod {
  id: string;
  type: LoginMethodType;
  label: string;
  icon?: string;
}

export interface ILoginConfig {
  title?: string;
  name?: string;
  favicon?: string;
  logo: string;
  backgroundColor: string;
  backgroundImage?: string;
  alginMode?: AlginMode;
  [Platform.WEB]: LoginMethod[];
  [Platform.MINIPROGRAM]?: LoginMethod[];
  showDoc?: boolean;
  copyright?: string;
  agreement?: SettingItem;
}

export interface SettingItem {
  id?: string;
  enable?: boolean;
  type?: string;
  label?: string;
  value?: any;
  icon?: string;
  items?: SettingItem[];
}

export enum LoginErrorCode {
  NOT_SUPPORT_LOCAL_STORAGE = 'not_support_local_storage',
  ACCESS_CODE_LOGIN_FAIL = 'access_code_login_fail',
}
