<?php

declare(strict_types=1);

namespace App\Administration\Infrastructure\Api\Resource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Post;
use App\Administration\Infrastructure\Api\Processor\RequestPasswordResetProcessor;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * API Resource for password reset request.
 *
 * This endpoint accepts an email and generates a reset token.
 * Always returns success to prevent email enumeration.
 */
#[ApiResource(
    shortName: 'PasswordResetRequest',
    operations: [
        new Post(
            uriTemplate: '/password/forgot',
            processor: RequestPasswordResetProcessor::class,
            output: RequestPasswordResetOutput::class,
            name: 'request_password_reset',
        ),
    ],
)]
final class RequestPasswordResetInput
{
    #[Assert\NotBlank(message: 'L\'adresse email est requise.')]
    #[Assert\Email(message: 'L\'adresse email n\'est pas valide.')]
    public string $email = '';
}
