<?php

namespace App\Http\Controllers\Owner\Info\Release93;

class CampCalendar
{

    private $dates;

    public function getDate($date)
    {
        return $this->dates[$date] ?? [];
    }

    public function getDateTour($date, $Id_Tour)
    {
        $found = $this->dates[$date][$Id_Tour] ?? null;
        return $found;
    }

    public function setDate($date, $tour, $tourData)
    {
        if (!isset($this->dates[$date])) {
            $this->dates[$date] = [];
        }
        $this->dates[$date][$tour->Id_Tour] = $tourData;
    }

    public function getDatesNotEquals()
    {
        $dates = [];
        foreach ($this->dates as $date => $dateTour) {

            foreach ($dateTour as $Id_Tour => $tourData) {
                // dd($tourData);
                if ($tourData['Calendar_Amount'] !== $tourData['Found_Amount']) {
                    if (!isset($dates[$date])) {
                        $dates[$date] = [];
                    }
                    $dates[$date][$Id_Tour] = $tourData;
                }
            }
        }
        return $dates;
    }
}
