2026-09-02 23:47:00 +03:00
|
|
|
package agzam.vyatsu.domain.model
|
|
|
|
|
|
2026-09-03 19:41:26 +03:00
|
|
|
import java.time.LocalDate
|
2026-09-02 23:47:00 +03:00
|
|
|
|
2026-09-03 19:41:26 +03:00
|
|
|
data class SchedulePeriod(
|
|
|
|
|
val weekStart: LocalDate,
|
|
|
|
|
val weekEnd: LocalDate,
|
|
|
|
|
val season: Season
|
|
|
|
|
)
|
2026-09-02 23:47:00 +03:00
|
|
|
|
2026-09-03 19:41:26 +03:00
|
|
|
data class Schedule(
|
|
|
|
|
val groupId: String,
|
|
|
|
|
val periods: List<SchedulePeriod>,
|
2026-09-02 23:47:00 +03:00
|
|
|
val days: List<Day>
|
|
|
|
|
) {
|
2026-09-03 19:41:26 +03:00
|
|
|
fun periodOf(date: LocalDate): SchedulePeriod? =
|
|
|
|
|
periods.firstOrNull { !date.isBefore(it.weekStart) && !date.isAfter(it.weekEnd) }
|
2026-09-03 20:53:17 +03:00
|
|
|
|
|
|
|
|
fun daysOf(period: SchedulePeriod): List<Day> =
|
|
|
|
|
days.filter { !it.date.isBefore(period.weekStart) && !it.date.isAfter(period.weekEnd) }
|
2026-09-02 23:47:00 +03:00
|
|
|
}
|