package com.fabledsword.minstrel.api.endpoints

import com.fabledsword.minstrel.models.wire.PlayEndedRequest
import com.fabledsword.minstrel.models.wire.PlayOfflineRequest
import com.fabledsword.minstrel.models.wire.PlaySkippedRequest
import com.fabledsword.minstrel.models.wire.PlayStartedRequest
import com.fabledsword.minstrel.models.wire.PlayStartedResponse
import retrofit2.http.Body
import retrofit2.http.POST

/**
 * Retrofit interface for `POST /api/events`. Mirrors the relevant
 * slice of `flutter_client/lib/api/endpoints/events.dart`. All four
 * variants share the same URL — the discriminator is in the request
 * body's `type` field. Server contract is best-effort per spec;
 * callers (the live path in PlayEventsReporter) swallow errors and
 * fall back to the offline mutation queue on failure.
 */
interface EventsApi {
    @POST("api/events")
    suspend fun playStarted(@Body body: PlayStartedRequest): PlayStartedResponse

    @POST("api/events")
    suspend fun playEnded(@Body body: PlayEndedRequest)

    @POST("api/events")
    suspend fun playSkipped(@Body body: PlaySkippedRequest)

    @POST("api/events")
    suspend fun playOffline(@Body body: PlayOfflineRequest)
}
