package com.gh.gamecenter.feature.entity

import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
import java.text.SimpleDateFormat
import java.util.*

@Parcelize
class ServerCalendarNotifySetting(
    @SerializedName("notify_time")
    val notifyTime: Long = 0,
    @SerializedName("seconds_advance")
    val secondsAdvance: Int = 0,
    @SerializedName("by_app")
    val byApp: Boolean = false,
    @SerializedName("by_wechat")
    val byWechat: Boolean = false
) : Parcelable {
    fun getFormatTime(pattern: String): String? {
        if (notifyTime == 0L) return null
        val formatTime = SimpleDateFormat(pattern, Locale.CHINA)
        return formatTime.format(notifyTime * 1000)
    }
}