<?php

namespace App\SiteReadiness\Checks;

use App\SiteReadiness\CheckResult;
use App\SiteReadiness\ReadinessCheck;
use App\SiteReadiness\Status;

class RecaptchaConfiguredCheck implements ReadinessCheck
{
    public function group(): string { return 'Integrations'; }
    public function label(): string { return 'reCAPTCHA active on auth forms'; }
    public function hint(): string { return 'Set RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY in .env to enable.'; }

    public function run(): CheckResult
    {
        $siteKey   = (string) (config('recaptcha.site_key') ?? '');
        $secretKey = (string) (config('recaptcha.secret_key') ?? '');
        $set       = $siteKey !== '' && $secretKey !== '';

        if ($set) {
            return new CheckResult(Status::OK, 'reCAPTCHA keys configured.');
        }

        return new CheckResult(
            Status::WARN,
            'reCAPTCHA inactive - no bot protection on login/register/password forms.',
        );
    }
}
