package com.gh.gamecenter.room.converter

import androidx.room.TypeConverter
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.entity.TagStyleEntity

class TagStyleListConverter {

    @TypeConverter
    fun listToJson(dataList: ArrayList<TagStyleEntity>?): String {
        return dataList?.toJson() ?: ""
    }

    @TypeConverter
    fun jsonToList(value: String?): ArrayList<TagStyleEntity> {
        val apkArray = value?.toObject() ?: arrayOf<TagStyleEntity>()
        return ArrayList(apkArray.toList())
    }

}