<?php

namespace GriffinForms\Includes\Integrations\WooCommerce;

/**
 * WooCommerce Integration (Coming Soon)
 *
 * Placeholder for future store automation support.
 *
 * @since 1.0.0
 */
class Main extends \GriffinForms\Includes\Integrations\Format
{
    protected function setMeta()
    {
        $this->meta = 'woocommerce';
        $this->id = 'woocommerce';
    }

    protected function buildInfo(): array
    {
        return [
            'id'          => 'woocommerce',
            'name'        => 'WooCommerce',
            'category'    => 'E-commerce',
            'description' => __('Create customers, orders, and follow-up automations inside WooCommerce. Launching soon.', 'griffinforms-form-builder'),
            'scope'       => [
                'is_global'      => true,
                'allow_override' => false,
            ],
            'coming_soon' => true,
        ];
    }

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

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

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

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

    public function isLibraryInstalled(): bool
    {
        return class_exists('\WooCommerce');
    }

    public function getLibraryInstructions(): string
    {
        return __('Ensure WooCommerce is installed and activated. Configuration will unlock once the integration launches.', 'griffinforms-form-builder');
    }

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

    public function getConfigurationFormHtml(): string
    {
        $message = '<div class="alert alert-info">' .
            esc_html__('WooCommerce automation is launching soon. Installation instructions will appear here when ready.', 'griffinforms-form-builder') .
            '</div>';

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