package com.sambath.kunkhmer.remote

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class FighterResponse(
    @Json(name = "code")
    val resultCode: Int,
    @Json(name = "message")
    val message: ResponseMessage,
    @Json(name = "data")
    val data: FightersData?
)

@JsonClass(generateAdapter = true)
data class FightersData(
    @Json(name = "object")
    val obj: List<FightersInfo>,
)

@JsonClass(generateAdapter = true)
data class FightersInfo(
    @Json(name = "file_id")
    val fighterFile: FighterFile?,

    @Json(name = "_id")
    val id: String,
    @Json(name = "name")
    val name: String,
    @Json(name = "desc")
    val desc: String,
    @Json(name = "weight")
    val weight: String,
    @Json(name = "high")
    val height: String,
    @Json(name = "nationality")
    val nationality: String,
    @Json(name = "createdAt")
    val createdAt: String,
    @Json(name = "updatedAt")
    val updatedAt: String,
    @Json(name = "__v")
    val _v: Int,
)

@JsonClass(generateAdapter = true)
data class FighterFile(
    @Json(name = "fieldname")
    val fieldName: String,
    @Json(name = "originalname")
    val originalName: String,
//    @Json(name = "encoding")
//    val encoding: String,
    @Json(name = "mimetype")
    val mimetype: String,
    @Json(name = "id")
    val id: String,
    @Json(name = "filename")
    val filename: String,
//    @Json(name = "metadata")
//    val metadata: String = "",
//    @Json(name = "bucketName")
//    val bucketName: String,
//    @Json(name = "chunkSize")
//    val chunkSize: Int,
//    @Json(name = "size")
//    val size: Int,
//    @Json(name = "md5")
//    val md5: String,
//    @Json(name = "uploadDate")
//    val uploadDate: String,
//    @Json(name = "contentType")
//    val contentType: String,
)


// ----------------- Match Data Model
@JsonClass(generateAdapter = true)
data class MatchesResponse(
    @Json(name = "code")
    val resultCode: Int,
    @Json(name = "message")
    val message: ResponseMessage,
    @Json(name = "data")
    val data: MatchesData?
)

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

@JsonClass(generateAdapter = true)
data class MatchesData(
    @Json(name = "object")
    val obj: List<Matches>,
)

@JsonClass(generateAdapter = true)
data class Matches(
    @Json(name = "_id")
    val matchInfo: String,
    @Json(name = "title")
    val title: String,
    @Json(name = "desc")
    val desc: String,
    @Json(name = "date")
    val date: String,
//    @Json(name = "fighterA")
//    val fighterA: String? = "N/A",
//    @Json(name = "fighterB")
//    val fighterB: String? = "N/A",
    @Json(name = "fighters")
    val fighters: List<Fighters>,
)

@JsonClass(generateAdapter = true)
data class MatchInfo(
    @Json(name = "_id")
    val id: String,
    @Json(name = "desc")
    val desc: String,
    @Json(name = "date")
    val date: String,
    @Json(name = "title")
    val title: String,
    @Json(name = "createdAt")
    val createdAt: String,
)

@JsonClass(generateAdapter = true)
data class Fighters(
    @Json(name = "_id")
    val id: String,
    @Json(name = "name")
    val name: String,
    @Json(name = "desc")
    val desc: String,
    @Json(name = "weight")
    val weight: String,
    @Json(name = "high")
    val high: String,
    @Json(name = "nationality")
    val nationality: String,
    @Json(name = "filename")
    val filename: String,
)

//------------- Create Match Data Model

@JsonClass(generateAdapter = true)
class CreateMatchRequest(
    @Json(name = "date")
    val date: String,
    @Json(name = "title")
    val title: String,
    @Json(name = "desc")
    val desc: String,
    @Json(name = "fighter_id")
    val fighterId: List<String>
)

@JsonClass(generateAdapter = true)
data class CreateMatchResponse(
    @Json(name = "code")
    val resultCode: Int,
    @Json(name = "message")
    val message: ResponseMessage,
    //@Json(name = "data")
    //val data: MatchCreatedData?
)

@JsonClass(generateAdapter = true)
data class MatchCreatedData(
    @Json(name = "match")
    val obj: CreatedMatch,
)

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

    @Json(name = "fighter_id")
    val fighterId: List<String>,

    @Json(name = "_id")
    val id: String,

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

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

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

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

    @Json(name = "__v")
    val _v: Int,
)

///

@JsonClass(generateAdapter = true)
data class CreateFighterResponse(
    @Json(name = "code")
    val resultCode: Int,
    @Json(name = "message")
    val message: ResponseMessage,
)