package club.clubk.ktag.apps.koth

/**
 * Immutable data class representing the game score data.
 */
data class GameData(
    val redTeamMillis: Long = 0L,
    val blueTeamMillis: Long = 0L
) {
    val isRedAhead: Boolean
        get() = redTeamMillis > blueTeamMillis

    val isBlueAhead: Boolean
        get() = blueTeamMillis > redTeamMillis

    val isTie: Boolean
        get() = redTeamMillis == blueTeamMillis

    fun addRed(milliseconds: Long): GameData =
        copy(redTeamMillis = redTeamMillis + milliseconds)

    fun addBlue(milliseconds: Long): GameData =
        copy(blueTeamMillis = blueTeamMillis + milliseconds)

    companion object {
        fun empty() = GameData()
    }
}
