<?php

declare(strict_types=1);

namespace App\ApiResources\OnlineRegistration;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\ApiResources\ApiResourcesInterface;
use App\State\Provider\OnlineRegistration\RegistrationAvailabilityProvider;

#[ApiResource(
    operations: [
        new Get(
            uriTemplate: '/online_registration/availability/{accessId}',
            requirements: ['accessId' => '\\d+'],
            defaults: ['accessId' => 0],
            provider: RegistrationAvailabilityProvider::class
        ),
    ]
)]
class RegistrationAvailability implements ApiResourcesInterface
{
    #[ApiProperty(identifier: true)]
    private int $accessId;

    private bool $available;

    private ?string $message = null;

    public function getAccessId(): int
    {
        return $this->accessId;
    }

    public function setAccessId(int $accessId): void
    {
        $this->accessId = $accessId;
    }

    public function isAvailable(): bool
    {
        return $this->available;
    }

    public function setAvailable(bool $available): void
    {
        $this->available = $available;
    }

    public function getMessage(): ?string
    {
        return $this->message;
    }

    public function setMessage(?string $message): void
    {
        $this->message = $message;
    }
}
