package com.fabledsword.minstrel.models.wire

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
 * `POST /api/auth/login` request body.
 */
@Serializable
data class LoginRequestBody(
    val username: String,
    val password: String,
)

/**
 * `POST /api/auth/login` response. Server emits `{token, user{id,
 * username, is_admin}}`. The cookie path actually carries the
 * session — the token is duplicated here for clients that prefer
 * header-based auth (not us). We use the AuthCookieInterceptor's
 * Set-Cookie capture instead.
 */
@Serializable
data class LoginResponseWire(
    val token: String = "",
    val user: UserWire,
)

/**
 * Mirrors `internal/api/types.go UserView` — the narrow caller-facing
 * user shape. `is_admin` is always present in the response but
 * tolerated as missing (default false) so older fixtures load.
 */
@Serializable
data class UserWire(
    val id: String,
    val username: String,
    @SerialName("is_admin") val isAdmin: Boolean = false,
)
