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.common.entity.CommunityEntity

class CommunityConverter {
    @TypeConverter
    fun toCommunityString(data: CommunityEntity?): String {
        return data?.toJson() ?: ""
    }

    @TypeConverter
    fun toCommunityEntity(token: String?): CommunityEntity {
        return token?.toObject() ?: CommunityEntity()
    }
}