<?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\SuitableAccommodationType\DTO;

use BookiFlex\Core\Model\AccommodationType\Accommodation\AccommodationType;
use BookiFlex\Core\Model\AccommodationType\Scheme\AllocationScheme;

defined( 'ABSPATH' ) || exit;

class SuitableAccommodationTypeResult
{
    /**
     * @param AccommodationType $suitableAccommodationType
     * @param int $quota
     * @param AllocationScheme|null $allocationScheme Concrete placement scheme for the requested guests,
     *                                                or null when the search was made without an explicit guest count.
     *
     * NOTE: Any listener of {@see \BookiFlex\Core\Service\SuitableAccommodationType\Event\SuitableAccommodationTypesAreFound}
     * that rebuilds these results (e.g. to adjust quota) MUST carry over $allocationScheme, otherwise the
     * concrete guest allocation is lost and offer occupancy details cannot be resolved downstream.
     */
    public function __construct(
        private readonly AccommodationType $suitableAccommodationType,
        private readonly int $quota = 0,
        private readonly ?AllocationScheme $allocationScheme = null
    ) {
    }

    public function getAccommodationType(): AccommodationType
    {
        return $this->suitableAccommodationType;
    }

    public function getQuota(): int
    {
        return $this->quota;
    }

    public function getAllocationScheme(): ?AllocationScheme
    {
        return $this->allocationScheme;
    }
}
