<?php

declare(strict_types=1);

namespace App\Administration\Infrastructure\Api\Resource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Administration\Infrastructure\Api\Provider\ActivationTokenInfoProvider;

/**
 * API Resource for retrieving activation token information.
 *
 * Used by the frontend to display the establishment name and role
 * before the user submits their password.
 */
#[ApiResource(
    shortName: 'ActivationTokenInfo',
    operations: [
        new Get(
            uriTemplate: '/activation-tokens/{tokenValue}',
            provider: ActivationTokenInfoProvider::class,
            name: 'get_activation_token_info',
        ),
    ],
)]
final readonly class ActivationTokenInfo
{
    public function __construct(
        public string $tokenValue,
        public string $email,
        public string $role,
        public string $schoolName,
        public bool $isExpired,
        public string $expiresAt,
    ) {
    }
}
