package com.fabledsword.minstrel.cache.db.entities

import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant

/**
 * Cache row for one playlist (user or system). Mirrors
 * `flutter_client/lib/cache/db.dart`'s `CachedPlaylists` Drift table.
 *
 * `systemVariant` is null for user playlists and one of
 * "for_you" / "songs_like_artist" / "discover" / "todays_mix" / etc.
 * for system-generated mixes. Lets the add-to-playlist sheet filter
 * system playlists locally without a REST round-trip.
 */
@Entity(tableName = "cached_playlists")
data class CachedPlaylistEntity(
    @PrimaryKey val id: String,
    val userId: String,
    val name: String,
    val description: String = "",
    val isPublic: Boolean = false,
    val coverPath: String? = null,
    val trackCount: Int = 0,
    val durationSec: Int = 0,
    val systemVariant: String? = null,
    val fetchedAt: Instant = Clock.System.now(),
)
