<?php

namespace GriffinForms\Admin\App\Html\Widgets\TitleBar;

final class IntegrationsBtn extends \GriffinForms\Admin\App\Html\Widgets\TitleBar\Format
{
    /**
     * Render SVG icon button for integrations
     */
    public function getHtml()
    {
        echo '<div class="position-relative me-2">';
        $this->getSvgIcon();
        echo '</div>';
    }

    /**
     * Output SVG icon with button wrapper
     * Uses SVG placeholder from config root URL
     */
    private function getSvgIcon()
    {
        // Path to SVG icon in /admin/images/icons/
        $icon_path = $this->config->getRootUrl() . 'admin/images/icons/integrations.svg';

        echo '<button type="button"
                   class="griffinforms-integrations-btn components-button has-icon p-1"
                   aria-label="' . esc_attr(__('Integrations', 'griffinforms-form-builder')) . '"
                   title="' . esc_attr(__('Manage Integrations', 'griffinforms-form-builder')) . '"
                   data-bs-toggle="modal"
                   data-bs-target="#griffinforms-builder-modal-integrations">';

        // SVG placeholder - replace with actual icon
        echo '<img src="' . esc_url($icon_path) . '" alt="' . esc_attr(__('Integrations', 'griffinforms-form-builder')) . '">';

        echo '</button>';
    }

    /**
     * No JavaScript needed for basic icon button
     * Modal toggle is handled by Bootstrap data attributes
     */
    public function getJs()
    {
        // Currently empty - placeholder for future JavaScript
        // When you're ready to add modal functionality, add JS here
    }
}
