package net.pokeranalytics.android.model.interfaces

import net.pokeranalytics.android.ui.graph.GraphUnderlyingEntry
import net.pokeranalytics.android.ui.graph.ObjectIdentifier
import java.util.*

interface Timed : GraphUnderlyingEntry, Identifiable {

    fun startDate() : Date?

    fun endDate() : Date

    var breakDuration: Long

    var pauseDate: Date?

    var netDuration: Long

    /**
     * Computes the net netDuration of the session
     */
    fun computeNetDuration() {
        this.startDate()?.let { start ->
            this.netDuration = this.endDate().time - start.time - this.breakDuration
        } ?: run {
            this.netDuration = 0L
        }
    }

    val hourlyDuration: Double
        get() = this.netDuration / 3600000.0

    val objectIdentifier : ObjectIdentifier

}