package com.casic.br.utils

import com.casic.br.model.UserModel
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.pengxh.kt.lite.utils.SaveKeyValues

object DeserializeModel {

    private val gson by lazy { Gson() }

    fun getUserModel(): UserModel? {
        val userJson = SaveKeyValues.getValue(LocaleConstant.USER_MODEL, "") as String
        if (userJson == "") {
            return null
        }
        return gson.fromJson(userJson, object : TypeToken<UserModel>() {}.type)
    }
}