package xyz.cottongin.radio247.data.model

import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey

@Entity(
    tableName = "listening_sessions",
    foreignKeys = [ForeignKey(
        entity = Station::class,
        parentColumns = ["id"],
        childColumns = ["stationId"],
        onDelete = ForeignKey.CASCADE
    )],
    indices = [Index("stationId")]
)
data class ListeningSession(
    @PrimaryKey(autoGenerate = true) val id: Long = 0,
    val stationId: Long,
    val startedAt: Long,
    val endedAt: Long? = null
)
