package de.tsschulz.tt_tagebuch.shared.models

import kotlinx.serialization.Serializable

@Serializable
data class User(
    val id: Int,
    val email: String,
    val isActive: Boolean
)

@Serializable
data class LoginResponse(
    val success: Boolean,
    val token: String? = null,
    val user: User? = null,
    val error: String? = null
)

@Serializable
data class Club(
    val id: Int,
    val name: String,
    val greetingText: String? = null
)

@Serializable
data class DiaryDate(
    val id: Int,
    val date: String,
    val clubId: Int,
    val trainingStart: String? = null,
    val trainingEnd: String? = null,
    val excludeFromBilling: Boolean = false,
    val activities: List<DiaryActivity> = emptyList(),
    val participants: List<Participant> = emptyList()
)

@Serializable
data class Member(
    val id: Int,
    val firstName: String,
    val lastName: String,
    val clubId: Int,
    val active: Boolean = true,
    val birthDate: String? = null,
    val gender: String? = null,
    val ttr: Int? = null,
    val qttr: Int? = null,
    val testMembership: Boolean = false,
    val picsInInternetAllowed: Boolean = false,
    val memberFormHandedOver: Boolean = false,
    val adultReleaseApproved: Boolean = false,
    val adultReserveApproved: Boolean = false,
    val lastTraining: String? = null,
    val trainingParticipations: Int = 0,
    val notInTraining: Boolean = false,
    val missedTrainingWeeks: Int = 0,
    val latestImageUrl: String? = null,
    val contacts: List<MemberContact> = emptyList()
)

@Serializable
data class MemberContact(
    val id: Int? = null,
    val type: String, // "phone" or "email"
    val value: String,
    val isParent: Boolean = false,
    val parentName: String? = null,
    val isPrimary: Boolean = false
)

@Serializable
data class Participant(
    val id: Int,
    val memberId: Int,
    val diaryDateId: Int,
    val attendanceStatus: String = "present", // "present", "excused", "cancelled"
    val notes: String? = null,
    val groupId: Int? = null,
    val member: Member? = null
)

@Serializable
data class DiaryActivity(
    val id: Int,
    val diaryDateId: Int,
    val description: String
)

@Serializable
data class DiaryNote(
    val id: Int,
    val diaryDateId: Int,
    val content: String,
    val userId: Int
)
