import { Language } from '@/constants/language'
import { AppTheme } from '@/constants/theme'
import WebStorage from '@/utils/storage'

function createLocalData() {
    return {
        appLanguage: Language.ZhCN,
        appTheme: AppTheme.Default,
        loginInfo: <Proto.LoginRsp | undefined>undefined,
        autoLoginEncryptedData: '', // 自动登录加密数据
    }
}

function createSessionData() {
    return {
        loginInfo: <Proto.LoginRsp | undefined>undefined,
        userRoutes: <Ermcp.UserRoutes[]>[],
        allEnums: <Ermcp.EnumRsp[]>[], // 枚举信息
        errorInfos: <Ermcp.ErrorInfosRsp[]>[], // 错误信息
        performanceStepTypes: <Ermcp.WrPerformanceStepTypeRsp[]>[], // 履约步骤枚举
        performanceTemplates: <Ermcp.PermancePlanTmpRsp[]>[], // 履约模板
        tableColumns: <Ermcp.TableDefineRsp[]>[],
    }
}

export const localData = new WebStorage(localStorage, createLocalData(), 'gz@')
export const sessionData = new WebStorage(sessionStorage, createSessionData(), 'gz@')