<?php

declare(strict_types=1);

namespace BookiFlex\Extensions\Notification\Api\Request;

use BookiFlex\Core\Api\Request\AbstractRequest;
use WP_REST_Request;

defined( 'ABSPATH' ) || exit;

class GetReservationNotificationsRequest extends AbstractRequest
{
    public function __construct(
        private readonly int $reservationId
    ) {
    }

    public static function fromWpRestRequest(WP_REST_Request $request): self
    {
        return new self(
            reservationId: (int) $request->get_param('reservationId')
        );
    }

    public static function getValidationRules(): array
    {
        return [
            'reservationId' => self::positiveIntRule(required: true),
        ];
    }

    public function getReservationId(): int
    {
        return $this->reservationId;
    }
}