package xyz.cottongin.radio247.service

import xyz.cottongin.radio247.audio.IcyMetadata
import xyz.cottongin.radio247.audio.StreamInfo
import xyz.cottongin.radio247.data.model.Station

sealed interface PlaybackState {
    data object Idle : PlaybackState
    data class Connecting(
        val station: Station,
        val urls: List<String> = emptyList(),
        val currentUrlIndex: Int = 0,
        val sessionStartedAt: Long = System.currentTimeMillis()
    ) : PlaybackState
    data class Playing(
        val station: Station,
        val metadata: IcyMetadata? = null,
        val sessionStartedAt: Long = System.currentTimeMillis(),
        val connectionStartedAt: Long = System.currentTimeMillis(),
        val streamInfo: StreamInfo? = null
    ) : PlaybackState
    data class Paused(
        val station: Station,
        val metadata: IcyMetadata? = null,
        val sessionStartedAt: Long,
        val streamInfo: StreamInfo? = null
    ) : PlaybackState
    data class Reconnecting(
        val station: Station,
        val metadata: IcyMetadata? = null,
        val sessionStartedAt: Long,
        val attempt: Int = 1
    ) : PlaybackState
}
