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

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

/**
 * Like membership row. Mirrors `flutter_client/lib/cache/db.dart`'s
 * `CachedLikes` Drift table. Composite primary key — one user may
 * independently like a track AND its album AND its artist; rows are
 * disambiguated by the (userId, entityType, entityId) triple.
 *
 * `entityType` is one of "track" | "album" | "artist". Stored as a
 * plain string for parity with the Drift schema and the server's wire
 * format; an enum doesn't earn its keep here.
 */
@Entity(
    tableName = "cached_likes",
    primaryKeys = ["userId", "entityType", "entityId"],
)
data class CachedLikeEntity(
    val userId: String,
    val entityType: String,
    val entityId: String,
    val likedAt: Instant = Clock.System.now(),
)
