<?php

declare(strict_types=1);

namespace BotGuard\Services\Captcha;

/**
 * Result of verifying a challenge response.
 */
final class CaptchaResult
{
    /**
     * @param array<string, mixed> $detail
     */
    public function __construct(
        public readonly bool $verified,
        public readonly string $provider,
        public readonly int $solveTimeMs = 0,
        public readonly int $retries = 0,
        public readonly array $detail = [],
    ) {
    }

    public static function fail(string $provider, array $detail = []): self
    {
        return new self(false, $provider, 0, 0, $detail);
    }
}
