<?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\Enum\OnlineRegistration\RegistrationStatusEnum;
use App\State\Provider\OnlineRegistration\RegistrationStatusProvider;
use Symfony\Component\Validator\Constraints as Assert;

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

    #[Assert\Type(type: RegistrationStatusEnum::class)]
    private ?RegistrationStatusEnum $status = null;

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

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

    public function getStatus(): ?RegistrationStatusEnum
    {
        return $this->status;
    }

    public function setStatus(?RegistrationStatusEnum $status): void
    {
        $this->status = $status;
    }
}
