package com.khmer9.yuki.screen.detail

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

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

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

    @Json(name = "data")
    val data: BettingDetailData
)

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

@JsonClass(generateAdapter = true)
data class BettingDetailData(
    @Json(name = "total_amount")
    val totalAmount: String,

    @Json(name = "total_amount_win")
    val totalAmountWin: Double? = 0.0,

    @Json(name = "total_cast")
    val totalCast: Double? = 0.0,

    @Json(name = "count")
    val count: Int,

    @Json(name = "list")
    val bettingDetailList: List<BettingDetailObject>?
)

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

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

    @Json(name = "betting")
    val betting: String,

    @Json(name = "bet_color")
    val betColor: String,

    @Json(name = "is_release_result")
    val isReleaseResult: Boolean,

    @Json(name = "bet_result")
    val betResult: BetResult,

    @Json(name = "return_amount")
    val amount: String,

    @Json(name = "time")
    val time: String,
) : BaseListItem() {
    override fun getUnique(): String = id
}

@JsonClass(generateAdapter = true)
data class BetResult(
    @Json(name = "is_win")
    val isWin: Boolean?,

    @Json(name = "name")
    val name: String?,
)