<?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\Model\AccommodationType\Guest;

defined( 'ABSPATH' ) || exit;

/**
 * Adult guest
 */
final class AdultGuest extends GuestType
{
    private int $quantity;

    public function __construct(int $quantity = 1)
    {
        if ($quantity < 1) {
            throw new \InvalidArgumentException("Quantity must be at least 1");
        }
        $this->quantity = $quantity;
    }

    public function getQuantity(): int
    {
        return $this->quantity;
    }

    public function getTypeKey(): string
    {
        return 'adult';
    }

    public function getVariantKey(): string
    {
        return "__{$this->quantity}";
    }

    public function matches(GuestType $other): bool
    {
        return $other instanceof self && $other->getQuantity() === $this->quantity;
    }
}
