package de.tsschulz.tt_tagebuch.shared.api

import de.tsschulz.tt_tagebuch.shared.api.http.AuthedHttpClient
import de.tsschulz.tt_tagebuch.shared.api.models.AccidentReportDto
import de.tsschulz.tt_tagebuch.shared.api.models.CreateAccidentBody
import io.ktor.client.call.body
import io.ktor.client.request.get
import io.ktor.client.request.post
import io.ktor.client.request.setBody

class AccidentApi(
    private val client: AuthedHttpClient,
) {
    suspend fun list(clubId: Int, diaryDateId: Int): List<AccidentReportDto> {
        return client.http.get("/api/accident/$clubId/$diaryDateId").body()
    }

    suspend fun create(body: CreateAccidentBody) {
        client.http.post("/api/accident") {
            setBody(body)
        }
    }
}
