package com.gh.gamecenter.room.converter

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

class StringArrayListConverter {

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

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

}