package com.sambath.kunkhmer.remote

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

@JsonClass(generateAdapter = true)
class LoginRequest(
    @Json(name = "user_name")
    val username: String,
    @Json(name = "password")
    val password: String,
    @Json(name = "firebase_token")
    val firebaseToken: String = "OiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiN"
)

@JsonClass(generateAdapter = true)
data class LoginResponse(
    @Json(name = "code")
    val resultCode: Int,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: LoginData?
)

@JsonClass(generateAdapter = true)
data class ChangePwd(
    @Json(name = "old_password")
    val oldPassword: String,
    @Json(name = "new_password")
    val newPassword: String
)

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

@JsonClass(generateAdapter = true)
data class BettingResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: BettingData ?= null
)

@JsonClass(generateAdapter = true)
data class BettingData(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "fight_no")
    val fightNo: Int,
    @Json(name = "group_no")
    val groupNo: Int,
    @Json(name = "betting")
    val betting: String,
    @Json(name = "bet_color")
    val bet_color: String,
    @Json(name = "amount")
    val amount: String,
    @Json(name = "time")
    val time: String,
    @Json(name = "balance")
    val balance: String,
    @Json(name = "payout_wala")
    val payoutWala: String,
    @Json(name = "payout_meron")
    val payoutMeron: String
)

@JsonClass(generateAdapter = true)
data class CurrentBetData(
    @Json(name = "amount")
    val amount: String,
    @Json(name = "bet_color")
    val bet_color: String,
    @Json(name = "betting")
    val betting: String,
    @Json(name = "fight_no")
    val fightNo: Int,
    @Json(name = "group_no")
    val groupNo: Int,
    @Json(name = "time")
    val time: String,
    @Json(name = "_id")
    val _id: String,
) : BaseListItem() {
    override fun getUnique(): String = _id
}

@JsonClass(generateAdapter = true)
data class CurrentResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: List<CurrentBetData>
)

@JsonClass(generateAdapter = true)
data class TodayResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: List<TodayData>? = null
)

@JsonClass(generateAdapter = true)
data class TodayData(
    @Json(name = "amount")
    val amount: String,
    @Json(name = "bet_color")
    val bet_color: String,
    @Json(name = "betting")
    val betting: String,
    @Json(name = "fight_no")
    val fightNo: Int,
    @Json(name = "group_no")
    val groupNo: Int,
    @Json(name = "is_win")
    val isWin: Boolean,
    @Json(name = "result_color")
    val resultColor: String,
    @Json(name = "result_name")
    val resultName: String,
    @Json(name = "time")
    val time: String,
    @Json(name = "_id")
    val _id: String,
) : BaseListItem() {
    override fun getUnique(): String = _id
}

@JsonClass(generateAdapter = true)
data class BtnData(
    @Json(name = "amount")
    val amount: Int,
    @Json(name = "currency_type")
    val currencyType: Int,
    @Json(name = "label")
    val label: String,
    @Json(name = "order")
    val order: Int,
    @Json(name = "_id")
    val _id: String
)

@JsonClass(generateAdapter = true)
data class ButtonResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: List<BtnData>
)

@JsonClass(generateAdapter = true)
data class ChannelResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: ChannelData?
)

@JsonClass(generateAdapter = true)
data class UserResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: User?
)

@JsonClass(generateAdapter = true)
data class WeightResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: WeightData?
)

@JsonClass(generateAdapter = true)
data class WeightData(
    @Json(name = "wala")
    val wala: Wala?,
    @Json(name = "meron")
    val meron: Meron?,
    @Json(name = "amount_min")
    val amountMin: Int,
    @Json(name = "amount_max")
    val amountMax: Int
)

@JsonClass(generateAdapter = true)
data class Wala(
    @Json(name = "payout")
    val payout: String,
    @Json(name = "amount")
    val amount: String
)

@JsonClass(generateAdapter = true)
data class Meron(
    @Json(name = "payout")
    val payout: String,
    @Json(name = "amount")
    val amount: String
)

@JsonClass(generateAdapter = true)
data class BettingTypeResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: List<BettingTypeData>
)

@JsonClass(generateAdapter = true)
data class BettingTypeData(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "name")
    val name: String,
    @Json(name = "desc")
    val desc: String,
    @Json(name = "color")
    val color: String,
    @Json(name = "is_betting")
    val isBetting: Boolean
)

@JsonClass(generateAdapter = true)
data class ResultsResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: ResultsData
)

@JsonClass(generateAdapter = true)
data class ResultsData(
    @Json(name = "results")
    val results: List<Results>,
    @Json(name = "summary")
    val resultSummary: ResultSummary?,
)

@JsonClass(generateAdapter = true)
data class Results(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "fight_no")
    val fightNo: Int,
    @Json(name = "name")
    val name: String,
    @Json(name = "cid")
    val cid: Int,
    @Json(name = "rid")
    val rid: Int,
    @Json(name = "color")
    val color: String,
)

@JsonClass(generateAdapter = true)
data class ResultSummary(
    @Json(name = "MERON")
    val meron: Int,
    @Json(name = "WALA")
    val wala: Int,
    @Json(name = "TIE")
    val tie: Int,
    @Json(name = "CANCEL")
    val cancel: Int
)


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

@JsonClass(generateAdapter = true)
data class LoginData(
    @Json(name = "user")
    val user: User?,
    @Json(name = "token")
    val token: String?,
)

@JsonClass(generateAdapter = true)
data class ChannelData(
    @Json(name = "is_stop_video")
    val isStopVideo: Boolean,
    @Json(name = "enable")
    val enable: Boolean,
    @Json(name = "is_open")
    val is_open: Boolean? = null,
    @Json(name = "live_urls")
    val liveUrls: List<String>?,
    @Json(name = "_id")
    val id: String,
    @Json(name = "info")
    val info: String,
    @Json(name = "video_info")
    val videoInfo: String,
    @Json(name = "date")
    val date: String,
    @Json(name = "fight_no")
    val fightNo: Int,
    @Json(name = "group_no")
    val groupNo: Int,
    @Json(name = "column")
    val column: Int,
    @Json(name = "fix_column")
    val fixColumn: Int,
    @Json(name = "is_maintain")
    val isMaintain: Boolean,
    @Json(name = "maintain_desc")
    val maintainDesc: String,
    @Json(name = "__v")
    val v: String?,
)

@JsonClass(generateAdapter = true)
data class Limit(
    @Json(name = "amount_min")
    val amountMin: Int,

    @Json(name = "amount_max")
    val amountMax: Int,
)

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

    @Json(name = "type_of_betting")
    val typeOfBetting: String,

    @Json(name = "start_number")
    val startNumber: Int,

    @Json(name = "end_number")
    val endNumber: Int,

    @Json(name = "payment")
    val payment: Double,

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

    @Json(name = "type")
    val type: String

)

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


//    @Json(name = "role")
//    val roles: String,
//    @Json(name = "enable")
//    val readOnly: Boolean,
//    @Json(name = "account_info")
//    var accountInfo: String?,
//    @Json(name = "account_name")
//    var accountName: String?,
//    @Json(name = "account_number")
//    var accountNumber: String?,
//    @Json(name = "balance")
//    val accountBalances: Double,
//    @Json(name = "currency_type")
//    val currencyType: Int,
)

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

@JsonClass(generateAdapter = true)
data class ReportOneResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: ReportOneData
)

@JsonClass(generateAdapter = true)
data class ReportDepositResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: ReportDepositData
)

@JsonClass(generateAdapter = true)
data class ReportWithdrawResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: ReportWithdrawData
)

@JsonClass(generateAdapter = true)
data class ReportDepositData(
    @Json(name = "rows_per_page")
    val rowsPerPage: Int,
    @Json(name = "total_rows")
    val totalRows: Int,
    @Json(name = "page")
    val page: Int,
    @Json(name = "total_amount")
    val totalAmount: String,
    @Json(name = "total_pages")
    val totalPages: Int,
    @Json(name = "reports")
    val reports: List<ReportDeposit>
)

@JsonClass(generateAdapter = true)
data class ReportDeposit(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "date")
    val date: String,
    @Json(name = "amount")
    val amount: String,
    @Json(name = "old_balance")
    val oldBalance: String,
    @Json(name = "new_balance")
    val newBalance: String
): BaseListItem(){
    override fun getUnique(): String = _id
}

@JsonClass(generateAdapter = true)
data class ReportWithdrawData(
    @Json(name = "rows_per_page")
    val rowsPerPage: Int,
    @Json(name = "total_rows")
    val totalRows: Int,
    @Json(name = "page")
    val page: Int,
    @Json(name = "total_amount")
    val totalAmount: String,
    @Json(name = "total_pages")
    val totalPages: Int,
    @Json(name = "reports")
    val reports: List<ReportWithdraw>
)

@JsonClass(generateAdapter = true)
data class ReportWithdraw(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "date")
    val date: String,
    @Json(name = "amount")
    val amount: String,
    @Json(name = "old_balance")
    val oldBalance: String,
    @Json(name = "new_balance")
    val newBalance: String
): BaseListItem(){
    override fun getUnique(): String = _id
}

@JsonClass(generateAdapter = true)
data class ReportBody(
    @Json(name = "rows_per_page")
    val rowsPerPage: Int,
    @Json(name = "page")
    val page: Int,
    @Json(name = "start_date")
    val startDate: String,
    @Json(name = "end_date")
    val endDate: String
)

@JsonClass(generateAdapter = true)
data class ReportOneData(
    @Json(name = "rows_per_page")
    val rowsPerPage: Int,
    @Json(name = "total_rows")
    val totalRows: Int,
    @Json(name = "page")
    val page: Int,
    @Json(name = "total_pages")
    val totalPages: Int,
    @Json(name = "is_win")
    val isWin: Boolean,
    @Json(name = "turn_over")
    val turnOver: String,
    @Json(name = "amount_win_lose")
    val amountWinLose: String,
    @Json(name = "reports")
    val reports: List<ReportOne>
)

@JsonClass(generateAdapter = true)
data class ReportOne(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "date")
    val date: String,
    @Json(name = "payout")
    val payout: String,
    @Json(name = "group")
    val group: Int,
    @Json(name = "fight_no")
    val fightNo: Int,
    @Json(name = "bet_name")
    val betName: String,
    @Json(name = "bet_color")
    val betColor: String,
    @Json(name = "is_win")
    val is_win: Boolean? = null,
    @Json(name = "result_name")
    val resultName: String,
    @Json(name = "result_color")
    val resultColor: String,
    @Json(name = "amount_win")
    val amountWin: Int,
    @Json(name = "amount")
    val amount: Int,
    @Json(name = "cast")
    val cast: Int
): BaseListItem(){
    override fun getUnique(): String = _id
}

@JsonClass(generateAdapter = true)
data class ReportTwoResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: ReportTwoData
)

@JsonClass(generateAdapter = true)
data class ReportTwoData(
    @Json(name = "rows_per_page")
    val rowsPerPage: Int,
    @Json(name = "total_rows")
    val totalRows: Int,
    @Json(name = "page")
    val page: Int,
    @Json(name = "total_pages")
    val totalPages: Int,
    @Json(name = "results")
    val results: List<ReportTwo>
)

@JsonClass(generateAdapter = true)
data class ReportTwo(
    @Json(name = "_id")
    val _id: String,
    @Json(name = "date")
    val date: String,
    @Json(name = "name")
    val name: String?,
    @Json(name = "color")
    val color: String?,
    @Json(name = "group_no")
    val group: Int,
    @Json(name = "fight_no")
    val fightNo: Int
): BaseListItem(){
    override fun getUnique(): String = _id
}

@JsonClass(generateAdapter = true)
data class ReportThreeResponse(
    @Json(name = "code")
    val resultCode: String,
    @Json(name = "message")
    val message: LoginMessage,
    @Json(name = "data")
    val data: List<ReportThree>
)

@JsonClass(generateAdapter = true)
data class ReportThree(
    @Json(name = "date")
    val date: String,
    @Json(name = "amount")
    val amount: Int,
    @Json(name = "type")
    val type: String
): BaseListItem(){
    override fun getUnique(): String = date
}
