<?php
/**
 * BookiFlex Core
 *
 * @package    BookiFlex
 * @subpackage Core
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    GPL-2.0-or-later
 *
 * @link       https://bookiflex.com
 */

declare(strict_types=1);

namespace BookiFlex\Core\Service\DateUnit\DTO;

use BookiFlex\Core\Model\RatePlan\RatePlan;

defined( 'ABSPATH' ) || exit;

/**
 * Data Transfer Object for calendar data.
 * Contains rate plan, accommodation types with sync status, and date units grouped by accommodation type.
 */
class CalendarData
{
    /**
     * @param RatePlan $ratePlan The rate plan entity
     * @param array $accommodationTypesData Array of accommodation types with their metadata
     *              Format: [['accommodationType' => AccommodationType, 'isSync' => bool], ...]
     * @param array $dateUnitsGrouped Date units grouped by accommodation type ID
     *              Format: [accommodationTypeId => [DateUnit, DateUnit, ...], ...]
     */
    public function __construct(
        private RatePlan $ratePlan,
        private array $accommodationTypesData,
        private array $dateUnitsGrouped
    ) {
    }

    /**
     * Get the rate plan entity
     */
    public function getRatePlan(): RatePlan
    {
        return $this->ratePlan;
    }

    /**
     * Get accommodation types data with sync status
     *
     * @return array Format: [['accommodationType' => AccommodationType, 'isSync' => bool], ...]
     */
    public function getAccommodationTypesData(): array
    {
        return $this->accommodationTypesData;
    }

    /**
     * Get date units grouped by accommodation type ID
     *
     * @return array Format: [accommodationTypeId => [DateUnit, DateUnit, ...], ...]
     */
    public function getDateUnitsGrouped(): array
    {
        return $this->dateUnitsGrouped;
    }
}
