<?php

namespace VulnTitan\SpamProtection\Providers;

use VulnTitan\Services\FluentFormSpamService;
use VulnTitan\SpamProtection\FormProviderAdapterInterface;

class FluentFormsProviderAdapter implements FormProviderAdapterInterface
{
    public function getKey(): string
    {
        return 'fluent_forms';
    }

    public function getLabel(): string
    {
        return 'Fluent Forms';
    }

    public function isAvailable(): bool
    {
        return defined('FLUENTFORM') && class_exists('\FluentForm\App\Modules\SubmissionHandler\SubmissionHandler');
    }

    public function isEnabled(array $settings): bool
    {
        return !empty($settings['form_shield_enabled']) && !empty($settings['form_provider_fluentforms_enabled']);
    }

    public function boot(): void
    {
        FluentFormSpamService::boot();
    }
}
