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

function createLocalData() {
    return {
        appLanguage: Language.ZhCN,
        appTheme: AppTheme.Default,
        autoLoginEncryptedData: '', // 自动登录加密数据
    }
}

function createSessionData() {
    return {
        loginInfo: <Proto.LoginRsp>{
            AccountIDs: [],
            LoginCode: '',
            LoginID: 0,
            LoginUserType: 0,
            AccountStatus: 0,
            UserID: 0,
            ClientID: 0,
            MemberUserID: 0,
            Token: '',
        },
        userRoutes: <Model.UserRoutes[]>[],
        allEnums: <Model.EnumRsp[]>[], // 枚举信息
        errorInfos: <Model.ErrorInfosRsp[]>[], // 错误信息
    }
}

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