$intervals بازه‌های آزاد، به‌صورت timestamp مطلق * @param list $reasons `national_holiday`، `tenant_holiday`، `no_shift`، * `branch_closed`، `outside_branch_hours`، `exception`، * `resource_inactive`، `branch_inactive` */ public function __construct( public int $date, public int $dayOfWeek, public array $intervals, public array $reasons = [], ) {} public function isEmpty(): bool { return $this->intervals === []; } public function totalMinutes(): int { $total = 0; foreach ($this->intervals as $interval) { $total += intdiv($interval->end - $interval->start, 60); } return $total; } public function toArray(): array { return [ 'date' => $this->date, 'day_of_week' => $this->dayOfWeek, 'intervals' => array_map( static fn (TimeInterval $i): array => $i->toArray(), $this->intervals, ), 'total_minutes' => $this->totalMinutes(), 'reasons' => $this->reasons, ]; } }