package net.pokeranalytics.android.model.interfaces

import java.util.*

/**
 * Interface to let an object be filtered through specific time parameters
 */
interface TimeFilterable {

    var dayOfWeek : Int?
    var dayOfMonth : Int?
    var month : Int?
    var year : Int?

    /**
     * Call this method whenever the date of the object is modified
     */
    fun updateTimeParameter(startDate: Date?) {
        startDate?.let {
            val cal = Calendar.getInstance()
            cal.time = it
            dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
            dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
            month = cal.get(Calendar.MONTH)
            year = cal.get(Calendar.YEAR)
        }
    }
}