<?php

namespace GriffinForms\Admin\App\Html\Modals;

use GriffinForms\Traits\Singleton;
use GriffinForms\Admin\App\Html\Modals\FormOptions\Markup;
use GriffinForms\Admin\App\Html\Modals\FormOptions\Requests;
use GriffinForms\Admin\App\Html\Modals\FormOptions\Responses;
use GriffinForms\Admin\App\Html\Modals\FormOptions\Scripts;

class FormOptions extends \GriffinForms\Admin\App\Html\Modals\Format
{
    use Singleton;
    use Markup;
    use Requests;
    use Responses;
    use Scripts;

    protected $has_footer       = true;
    protected $modal_dialog_classes = ['modal-xl'];

    protected function getModalTitle()
    {
        return __('Form Options', 'griffinforms-form-builder');
    }

    protected function renderModalBodyHtml()
    {
        echo '<div class="gf-formoptions-layout">';
        $this->renderTabStrip();
        $this->renderTabPanels();
        echo '</div>';
    }

    public function getBodyHtml(): string
    {
        ob_start();
        $this->renderModalBodyHtml();
        return (string) ob_get_clean();
    }

    public function getModalJs()
    {
    }

    public function getJs()
    {
        parent::getJs();
        $this->renderScripts();
    }

    private function __construct()
    {
        add_action('wp_ajax_gf_get_formoptions_html', [$this, 'getFormOptionsHtml']);
        $this->setAll();
    }
}
