package ca.ksamad.encore.playback

/**
 * A request for a piece of MPD cover art, used as the model handed to Coil. The concrete type
 * doubles as the cache key (see the keyer in [ArtImageLoader]), so the same song/album resolves to
 * the same cached image.
 */
sealed interface MpdArtData

/**
 * Cover art for a specific song URI (used for now-playing and the notification).
 *
 * [version] is an opaque cache-bust token — typically the file's `Last-Modified` timestamp. It has
 * no effect on how the art is fetched (only [uri] matters for that); it only participates in the
 * cache key, so when a track is re-tagged/re-imported (its mtime changes) the new art is fetched
 * automatically instead of serving a stale cached copy.
 */
data class SongArt(
    val uri: String,
    val version: String? = null,
) : MpdArtData

/**
 * Cover art for an album (a representative track is resolved server-side). Deliberately has no
 * per-track version: every track of an album must resolve to one cache entry (see the queue), so
 * album art is refreshed via the manual "Refresh artwork" action rather than mtime.
 */
data class AlbumArt(
    val album: String,
    val albumArtist: String?,
) : MpdArtData
