<?php

namespace GriffinForms\Frontend\Html\Security\Captcha;

use GriffinForms\Settings;

/**
 * Base CAPTCHA provider adapter.
 */
abstract class Format
{
    protected $options = [];
    protected $form_id = 0;
    protected $settings;

    public function __construct(array $options, int $form_id)
    {
        $this->options = $options;
        $this->form_id = $form_id;
        $this->settings = Settings::getInstance();
    }

    /**
     * Whether this provider has enough configuration to run.
     */
    abstract public function isEnabled(): bool;

    /**
     * Render provider field markup for the given page position.
     */
    abstract public function renderField(string $position): string;

    /**
     * Enqueue any frontend scripts required by this provider.
     */
    abstract public function enqueueScripts(): void;

    /**
     * Token key stored in antispam_data.
     */
    abstract public function getTokenKey(): string;

    /**
     * Provide contextual data for frontend JS (site keys, versions, etc.).
     */
    abstract public function getClientContext(): array;

    /**
     * Validate submission data and return success + message.
     */
    abstract public function validateSubmission($antispam_data, array $form_data): array;
}
