<?php

namespace GriffinForms\Includes\Integrations\Square;

/**
 * Square payment integration stub.
 *
 * Real implementation is provided by GriffinForms Pro via the
 * griffinforms_integration_class filter. This stub ensures Core can
 * render the provider card (with Pro badge) when Pro is absent.
 */
class Main extends \GriffinForms\Includes\Integrations\Format
{
    protected function setMeta(): void
    {
        $this->meta = 'square';
        $this->id   = 'square';
    }

    protected function buildInfo(): array
    {
        return [
            'id'       => 'square',
            'name'     => 'Square',
            'category' => 'Payments',
        ];
    }

    public function getStatus(): array
    {
        return [
            'configured' => false,
            'active'     => false,
            'message'    => __('Requires GriffinForms Pro', 'griffinforms-form-builder'),
        ];
    }

    public function getConfigFields(): array
    {
        return [];
    }

    protected function saveConfiguration(array $config): bool
    {
        return false;
    }

    protected function validateConnection(): array
    {
        return [
            'success' => false,
            'message' => __('Square is not available. Activate GriffinForms Pro to use this integration.', 'griffinforms-form-builder'),
        ];
    }

    public function isLibraryInstalled(): bool
    {
        return true;
    }

    public function getLibraryInstructions(): string
    {
        return '';
    }

    public function isConfigured(): bool
    {
        return false;
    }

    public function getConfigurationFormHtml(): string
    {
        $message = '<div class="gf-notice gf-notice-info">' .
            esc_html__('Activate GriffinForms Pro to configure Square payments.', 'griffinforms-form-builder') .
            '</div>';

        return $this->renderConfigurationFormTemplate(
            'griffinforms-square-config',
            $this->id,
            $message
        );
    }
}
