package com.example.iot_controlhost.utils.database

import com.bbitcn.sericulture.base.BaseTempDataBase
import com.blankj.utilcode.util.GsonUtils
import com.example.iot_controlhost.model.net.ControlMode
import com.example.iot_controlhost.utils.MMKVUtil
import com.example.iot_controlhost.utils.global.AutoModelSet
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.tencent.mmkv.MMKV
import java.lang.reflect.Type

object TempTHVDBManager : BaseTempDataBase<Map<String, Any>>() {

    fun appSet() {
        for (data in getData()) {
            MMKVUtil.put(data.key, data.value)
        }
    }

    override fun getKey(): String = "control_mode_map1"

    override fun defaultData(): Map<String, Any> {
        return mapOf()
    }

    override fun getType(): Type {
        return object : TypeToken<Map<String, Any>>() {}.type
    }
    
    val STAGE_ID_NAME = "stage_id_name"
    val STAGE_ID_CONTENT = "stage_id_content"

    fun setStage(name: String?,content: String?) {
        MMKVUtil.put(STAGE_ID_NAME, name)
        MMKVUtil.put(STAGE_ID_CONTENT, content)
    }

    fun getStageName(): String? {
        return MMKVUtil.get(STAGE_ID_NAME, null)
    }
    fun getStageContent(): String? {
        return MMKVUtil.get(STAGE_ID_CONTENT, null)
    }

}