<?php

namespace GriffinForms\Includes\Integrations\Slack;

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

    protected function buildInfo(): array
    {
        return [
            'id'          => 'slack',
            'name'        => 'Slack',
            'category'    => 'Notifications',
            'description' => __('Real-time submission alerts inside Slack channels. Launching soon.', 'griffinforms-form-builder'),
            'scope'       => [
                'is_global'      => true,
                'allow_override' => true,
            ],
            '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' => __('Slack integration is not available yet.', 'griffinforms-form-builder'),
        ];
    }

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

    public function getLibraryInstructions(): string
    {
        return __('Configuration unlocks after launch.', 'griffinforms-form-builder');
    }

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

    public function getConfigurationFormHtml(): string
    {
        $message = '<div class="gf-notice gf-notice-info">' .
            esc_html__('Connect Slack channels here once the integration is available.', 'griffinforms-form-builder') .
            '</div>';

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