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

use BookiFlex\Core\Model\AccommodationType\Accommodation\AccommodationType;
use BookiFlex\Core\Model\AccommodationType\Scheme\AllocationScheme;
use BookiFlex\Core\Model\RatePlan\RatePlan;
use BookiFlex\Core\Service\StayCostCalculator\ValueObject\StayCostCalculatorResult;

defined( 'ABSPATH' ) || exit;

class OfferResult
{
    public function __construct(
        private readonly ?RatePlan                 $ratePlan,
        private readonly AccommodationType         $accommodationType,
        private readonly int                       $quota,
        private readonly ?StayCostCalculatorResult $stayCost = null,
        private readonly ?array                    $scenario = null,
        private readonly ?AllocationScheme         $allocationScheme = null
    ) {
    }

    public function getRatePlan(): ?RatePlan
    {
        return $this->ratePlan;
    }

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

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

    public function getRestrictions(): array
    {
        return $this->stayCost ? $this->stayCost->getRestrictions() : [];
    }

    /**
     * @return StayCostCalculatorResult|null
     */
    public function getStayCost(): ?StayCostCalculatorResult
    {
        return $this->stayCost;
    }

    public function getScenario(): ?array
    {
        return $this->scenario;
    }

    /**
     * Concrete guest allocation for this offer (people-level: who is placed where).
     * Null for abstract offers where no explicit guest configuration was requested.
     */
    public function getAllocationScheme(): ?AllocationScheme
    {
        return $this->allocationScheme;
    }
}
