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

import kotlinx.serialization.Serializable

@Serializable
data class InternalTournamentSummaryDto(
    val id: Int = 0,
    val name: String? = null,
    val date: String? = null,
    @Serializable(with = FlexibleNullableBooleanSerializer::class)
    val allowsExternal: Boolean? = null,
    val miniChampionshipYear: Int? = null,
    @Serializable(with = FlexibleNullableBooleanSerializer::class)
    val isDoublesTournament: Boolean? = null,
)

@Serializable
data class InternalTournamentDetailDto(
    val id: Int = 0,
    val name: String? = null,
    val date: String? = null,
    val type: String? = null,
    val clubId: Int? = null,
    val winningSets: Int? = null,
    @Serializable(with = FlexibleNullableBooleanSerializer::class)
    val allowsExternal: Boolean? = null,
    val miniChampionshipYear: Int? = null,
    val numberOfTables: Int? = null,
    val numberOfGroups: Int? = null,
    val advancingPerGroup: Int? = null,
    @Serializable(with = FlexibleNullableBooleanSerializer::class)
    val isDoublesTournament: Boolean? = null,
    val bestOfEndroundSize: Int? = null,
)

@Serializable
data class InternalTournamentStatsAgeOption(
    val key: String,
    val band: String? = null,
    val bandNum: Int? = null,
    val genderMode: String? = null,
    @Serializable(with = FlexibleNullableBooleanSerializer::class)
    val isNoClass: Boolean? = null,
)

@Serializable
data class InternalTournamentStatsRow(
    val memberId: Int = 0,
    val firstName: String? = null,
    val lastName: String? = null,
    val totalPoints: Double? = null,
    val tournamentCount: Int? = null,
    val averagePoints: Double? = null,
)

@Serializable
data class InternalTournamentStatsDto(
    val months: Int? = null,
    val fromDate: String? = null,
    val tournamentCount: Int = 0,
    val ageClassOptions: List<InternalTournamentStatsAgeOption> = emptyList(),
    val absoluteRanking: List<InternalTournamentStatsRow> = emptyList(),
    val averageRanking: List<InternalTournamentStatsRow> = emptyList(),
)

@Serializable
data class OfficialTournamentListRowDto(
    val id: Int = 0,
    val clubId: Int? = null,
    val title: String? = null,
    val eventDate: String? = null,
    val organizer: String? = null,
    val host: String? = null,
)

@Serializable
data class OfficialParticipationEntryDto(
    val memberId: Int? = null,
    val memberName: String? = null,
    val competitionId: Int? = null,
    val competitionName: String? = null,
    val placement: String? = null,
    val date: String? = null,
)

@Serializable
data class OfficialParticipationBucketDto(
    val tournamentId: String? = null,
    val title: String? = null,
    val startDate: String? = null,
    val endDate: String? = null,
    val entries: List<OfficialParticipationEntryDto> = emptyList(),
)
