<?php
declare(strict_types=1);

namespace App\ApiResource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Post;
use App\State\Processor\ContactRequestProcessor;
use Symfony\Component\Validator\Constraints as Assert;

#[ApiResource(
    operations: [
        new Post(
            uriTemplate: '/contact',
        ),
    ],
    processor: ContactRequestProcessor::class
)]
class ContactRequest
{
    #[Assert\Email(
        message: 'The email {{ value }} is not a valid email.',
    )]
    protected string $email;

    protected ?string $name = null;

    #[Assert\Length(
        min: 10,
        minMessage: 'Message must be at least {{ limit }} characters long',
    )]
    protected string $message;

    protected string $altchaPayload;

    public function getEmail(): string
    {
        return $this->email;
    }

    public function setEmail(string $email): void
    {
        $this->email = $email;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

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

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

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

    public function getAltchaPayload(): string
    {
        return $this->altchaPayload;
    }

    public function setAltchaPayload(string $altchaPayload): void
    {
        $this->altchaPayload = $altchaPayload;
    }
}