package com.fabledsword.minstrel.models.wire

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

/**
 * Wire shape of `requestView` from `internal/api/requests.go` — the
 * row returned by both `GET /api/requests` (caller's own requests) and
 * `GET /api/admin/requests` (cross-user admin view). Mirrors
 * `flutter_client/lib/models/admin_request.dart AdminRequest`.
 *
 * Status values: `pending` / `approved` / `rejected` / `completed` /
 * `failed`. Kind values: `artist` / `album` / `track`.
 *
 * `matched_*_id` are set after a completed request ingests into the
 * local library; the user-side "Listen" affordance picks the most
 * specific one (track → album → artist).
 */
@Serializable
data class RequestWire(
    val id: String,
    @SerialName("user_id") val userId: String = "",
    val status: String = "pending",
    val kind: String = "artist",
    @SerialName("artist_name") val artistName: String = "",
    @SerialName("album_title") val albumTitle: String? = null,
    @SerialName("track_title") val trackTitle: String? = null,
    @SerialName("requested_at") val requestedAt: String = "",
    @SerialName("decided_at") val decidedAt: String? = null,
    val notes: String? = null,
    @SerialName("imported_album_count") val importedAlbumCount: Int = 0,
    @SerialName("imported_track_count") val importedTrackCount: Int = 0,
    @SerialName("matched_track_id") val matchedTrackId: String? = null,
    @SerialName("matched_album_id") val matchedAlbumId: String? = null,
    @SerialName("matched_artist_id") val matchedArtistId: String? = null,
)
