package com.khmer9.yuki.remote

import com.gdtlib.lib.adapter.BaseListItem
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class ResultResponse(
    @Json(name = "code")
    val resultCode: String,

    @Json(name = "message")
    val message: ResultMessage,

    @Json(name = "data")
    val data: List<ResultLotto>?
)

@JsonClass(generateAdapter = true)
data class ResultMessage(
    @Json(name = "code")
    val code: String,

    @Json(name = "descriptions")
    val description: String
)

//----------------------------------------------------

@JsonClass(generateAdapter = true)
data class ResultLotto(
    @Json(name = "_id")
    var id: String,

    @Json(name = "no")
    var no: Int,

    @Json(name = "date")
    var date: String,

    @Json(name = "small_large")
    var smallLarge: SmallLarge,

    @Json(name = "bonus")
    var bonus: Bonus,

    @Json(name = "range")
    var range: Range,

    @Json(name = "blue_red")
    var blueRed: BlueRed,

    @Json(name = "odd_even")
    var oddEven: OddEven,

    @Json(name = "year")
    var year: Year

) : BaseListItem() {
    override fun getUnique(): String = id
}

@JsonClass(generateAdapter = true)
data class SmallLarge(
    @Json(name = "name")
    var name: String,

    @Json(name = "color")
    var color: String,

    @Json(name = "year_number")
    var yearNumber: Int

) : BaseListItem() {
    override fun getUnique(): String = name
}

@JsonClass(generateAdapter = true)
data class Bonus(
    @Json(name = "year_number")
    var name: String,

    @Json(name = "is_bonus")
    var isBonus: Boolean,

    @Json(name = "payout")
    var payout: Double,
) : BaseListItem() {
    override fun getUnique(): String = name
}

@JsonClass(generateAdapter = true)
data class Range(
    @Json(name = "name")
    var name: String,

    @Json(name = "color")
    var color: String,

    @Json(name = "year_number")
    var yearNumber: Int

) : BaseListItem() {
    override fun getUnique(): String = name
}

@JsonClass(generateAdapter = true)
data class BlueRed(
    @Json(name = "name")
    var name: String,

    @Json(name = "color")
    var color: String,

    @Json(name = "year_number")
    var yearNumber: Int

) : BaseListItem() {
    override fun getUnique(): String = name
}

@JsonClass(generateAdapter = true)
data class OddEven(
    @Json(name = "name")
    var name: String,

    @Json(name = "color")
    var color: String,

    @Json(name = "year_number")
    var yearNumber: Int

) : BaseListItem() {
    override fun getUnique(): String = name
}

@JsonClass(generateAdapter = true)
data class Year(
    @Json(name = "name")
    var name: String,

    @Json(name = "color")
    var color: String,

    @Json(name = "year_number")
    var yearNumber: Int

) : BaseListItem() {
    override fun getUnique(): String = name
}
