package com.fabledsword.minstrel.models

/**
 * One quarantined track owned by the caller. Mirrors the Flutter
 * `QuarantineMineRow` (web `LidarrQuarantineMineRow`).
 *
 * `reasonLabel` provides the display string mapped from the raw
 * server-side reason key — UI renders it as a pill on the row.
 */
data class QuarantineRef(
    val trackId: String,
    val reason: String,
    val notes: String? = null,
    val createdAt: String = "",
    val trackTitle: String = "",
    val trackDurationMs: Int = 0,
    val albumId: String = "",
    val albumTitle: String = "",
    val albumCoverArtPath: String? = null,
    val artistId: String = "",
    val artistName: String = "",
) {
    val reasonLabel: String
        get() = when (reason) {
            "bad_rip" -> "Bad rip"
            "wrong_file" -> "Wrong file"
            "wrong_tags" -> "Wrong tags"
            "duplicate" -> "Duplicate"
            else -> "Other"
        }

    /**
     * Cover URL derived from the parent album's
     * `/api/albums/{id}/cover` endpoint. Uses the placeholder host
     * that `BaseUrlInterceptor` rewrites to the live server URL.
     * Empty when the row has no album binding (rare).
     */
    val coverUrl: String
        get() = albumCoverPath(albumId)
}
