package de.tsschulz.tt_tagebuch.shared.api.models

import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement

@Serializable
data class OfficialTournamentUploadResultDto(
    val id: String,
)

@Serializable
data class OfficialPatchTournamentBody(
    val title: String? = null,
)

@Serializable
data class OfficialUpsertParticipationBody(
    val competitionId: Int,
    val memberId: Int,
    val wants: Boolean = false,
    val registered: Boolean = false,
    val participated: Boolean = false,
    val placement: String? = null,
)

@Serializable
data class OfficialParticipantStatusBody(
    val competitionId: Int,
    val memberId: Int,
    val action: String,
)

@Serializable
data class OfficialCompetitionMemberStateDto(
    val id: Int? = null,
    val tournamentId: Int? = null,
    val competitionId: Int = 0,
    val memberId: Int = 0,
    val wants: Boolean = false,
    val registered: Boolean = false,
    val participated: Boolean = false,
    val placement: String? = null,
)

@Serializable
data class OfficialParsedCompetitionDto(
    val id: Int = 0,
    val tournamentId: Int? = null,
    val ageClassCompetition: String? = null,
    val altersklasseWettbewerb: String? = null,
    val performanceClass: String? = null,
    val leistungsklasse: String? = null,
    val startTime: String? = null,
    val startzeit: String? = null,
    val openTo: String? = null,
    val offenFuer: String? = null,
    val cutoffDate: String? = null,
    val stichtag: String? = null,
    val registrationDeadlineDate: String? = null,
    val registrationDeadlineOnline: String? = null,
    val meldeschlussDatum: String? = null,
    val meldeschlussOnline: String? = null,
    val preliminaryRound: String? = null,
    val vorrunde: String? = null,
    val finalRound: String? = null,
    val endrunde: String? = null,
    val entryFee: String? = null,
    val startgeld: String? = null,
    val ttrRelevant: String? = null,
    val maxParticipants: Int? = null,
    val maxTeilnehmer: Int? = null,
)

@Serializable
data class OfficialParsedDataDto(
    val title: String? = null,
    val termin: String? = null,
    val austragungsorte: JsonElement? = null,
    val konkurrenztypen: JsonElement? = null,
    val meldeschluesse: JsonElement? = null,
    val entryFees: JsonElement? = null,
    val competitions: List<OfficialParsedCompetitionDto> = emptyList(),
)

@Serializable
data class OfficialParsedTournamentEnvelopeDto(
    val id: String? = null,
    val clubId: String? = null,
    val parsedData: OfficialParsedDataDto? = null,
    val participation: List<OfficialCompetitionMemberStateDto> = emptyList(),
)

@Serializable
data class OfficialUpsertParticipationResponseDto(
    val success: Boolean = false,
    val id: Int? = null,
)

@Serializable
data class OfficialParticipantStatusSnapshotDto(
    val wants: Boolean = false,
    val registered: Boolean = false,
    val participated: Boolean = false,
    val placement: String? = null,
)

@Serializable
data class OfficialParticipantStatusResponseDto(
    val success: Boolean = false,
    val id: Int? = null,
    val status: OfficialParticipantStatusSnapshotDto? = null,
)
