package com.fabledsword.minstrel.models.wire

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

/**
 * Wire shape for `TrackRef` as the server emits it. Mirrors
 * `flutter_client/lib/models/track.dart`'s `TrackRef.fromJson`
 * field-for-field; the keys are snake_case because the server is Go
 * (json:"album_id" etc.).
 *
 * Mappers in feature packages translate this to the domain TrackRef
 * data class and the `cached_tracks` Room entity. Default values match
 * the Flutter Dart-side "?? 0" / "?? ''" fallbacks for forward-compat
 * with sparse server responses.
 */
@Serializable
data class TrackWire(
    val id: String,
    val title: String,
    @SerialName("album_id") val albumId: String,
    @SerialName("album_title") val albumTitle: String = "",
    @SerialName("artist_id") val artistId: String,
    @SerialName("artist_name") val artistName: String = "",
    @SerialName("track_number") val trackNumber: Int? = null,
    @SerialName("disc_number") val discNumber: Int? = null,
    @SerialName("duration_sec") val durationSec: Int = 0,
    @SerialName("stream_url") val streamUrl: String = "",
)
