package com.adealink.weparty.country.data

import com.adealink.weparty.commonui.recycleview.diffutil.BaseListItemData
import com.google.gson.annotations.GsonNullable
import com.google.gson.annotations.SerializedName
import java.io.Serializable

data class CountryRes(
    @SerializedName("list") var list: List<CountryData>,
)

data class CountryData(
    @SerializedName("code") var code: String, //国家码
    @SerializedName("num") var regionCode: String, //电话区号
    @SerializedName("first") var first: String, //首字母

    @SerializedName("icon") var icon: String,
    @SerializedName("icon2") var icon2: String,
    @SerializedName("name") var name: String,

    @GsonNullable
    @SerializedName("pinyin") //名字pinyin
    var pinyinName: String? = null
) : Serializable {

    fun getDisplayName(): String {
        return pinyinName?.ifEmpty { name } ?: name
    }
}


sealed class BaseCountryItemData : BaseListItemData

data class CountryTitleItemData(
    val name: String
) : BaseCountryItemData()

data class CountryItemData(
    val data: CountryData
) : BaseCountryItemData()