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

import kotlinx.serialization.Serializable

@Serializable
data class AccidentReportDto(
    val accident: String,
    val firstName: String? = null,
    val lastName: String? = null,
)

fun AccidentReportDto.memberLabel(): String {
    val parts = listOfNotNull(firstName?.trim()?.takeIf { it.isNotEmpty() }, lastName?.trim()?.takeIf { it.isNotEmpty() })
    return if (parts.isEmpty()) "—" else parts.joinToString(" ")
}

@Serializable
data class CreateAccidentBody(
    val clubId: Int,
    val memberId: Int,
    val diaryDateId: Int,
    val accident: String,
)
