package io.github.js0ny.ilp_coursework.data.common;

import java.time.DayOfWeek;
import java.time.LocalTime;

public record DroneAvailability(String id, TimeWindow[] availability) {

    public boolean checkAvailability(DayOfWeek day, LocalTime time) {

        for (var a : availability) {
            if (a.dayOfWeek().equals(day)) {
                if (!time.isBefore(a.from()) && !time.isAfter(a.until())) {
                    return true;
                }
            }
        }

        return false;
    }
}
