<?php

namespace GriffinForms\Includes\Integrations\GoogleSheets;

/**
 * Google Sheets Integration (Coming Soon)
 */
class Main extends \GriffinForms\Includes\Integrations\Format
{
    protected function setMeta()
    {
        $this->meta = 'google_sheets';
        $this->id = 'google_sheets';
    }

    protected function buildInfo(): array
    {
        return [
            'id'          => 'google_sheets',
            'name'        => 'Google Sheets',
            'category'    => 'Productivity',
            'description' => __('Automatically sync form submissions into Google Sheets. Requires GriffinForms Pro.', 'griffinforms-form-builder'),
            'scope'       => [
                'is_global'      => true,
                'allow_override' => true,
            ],
            'coming_soon' => false,
        ];
    }

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

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

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

    protected function validateConnection(): array
    {
        return [
            'success' => false,
            'message' => __('Google Sheets integration is not available yet.', 'griffinforms-form-builder'),
        ];
    }

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

    public function getLibraryInstructions(): string
    {
        return __('Google Sheets configuration will go live soon.', 'griffinforms-form-builder');
    }

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

    public function getConfigurationFormHtml(): string
    {
        $message = '<div class="gf-notice gf-notice-info">' .
            esc_html__('Connect your Google account here once the Sheets integration launches.', 'griffinforms-form-builder') .
            '</div>';

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