<?php

declare(strict_types=1);

namespace App\Shared\Infrastructure\Captcha;

/**
 * Résultat de la validation Turnstile.
 */
final readonly class TurnstileResult
{
    private function __construct(
        public bool $isValid,
        public ?string $errorMessage,
    ) {
    }

    public static function valid(): self
    {
        return new self(isValid: true, errorMessage: null);
    }

    public static function invalid(string $errorMessage): self
    {
        return new self(isValid: false, errorMessage: $errorMessage);
    }
}
