<?php

namespace GriffinForms\Admin\App\Html\Modals;

use GriffinForms\Traits\Singleton;
use GriffinForms\Admin\App\Html\Modals\Accounts\Requests;
use GriffinForms\Admin\App\Html\Modals\Accounts\Responses;
use GriffinForms\Admin\App\Html\Modals\Accounts\Scripts;
use GriffinForms\Admin\App\Html\Modals\Accounts\RuleSummaries;
use GriffinForms\Admin\App\Html\Modals\Shared\GuidedFlowShell;

class Accounts extends \GriffinForms\Admin\App\Html\Modals\Format
{
    use Singleton;
    use Requests;
    use Responses;
    use Scripts;
    use RuleSummaries;
    use GuidedFlowShell;

    protected $required_capability = '';
    protected $register_ajax_handlers;
    protected $has_footer = false;

    protected function getModalTitle()
    {
        return __('User Registration', 'griffinforms-form-builder') . $this->getModalTitleSuffix();
    }

    protected function renderModalBodyHtml()
    {
        echo '<div class="griffinforms-accounts-message-container gf-notice-container mb-3"></div>';
        echo '<div class="griffinforms-accounts-content">';
        echo '<div id="griffinforms-accounts-discard-confirmation-host" class="gf-accounts-discard-confirmation-host d-none" aria-live="polite"></div>';
        echo '<div class="griffinforms-accounts-list-wrapper">';
        echo '<div class="fw-semibold mb-2">' . esc_html__('Create and review user registration workflows for this form.', 'griffinforms-form-builder') . '</div>';
        echo '<div id="griffinforms-accounts-rules-list" class="griffinforms-accounts-rules-list">';
        echo esc_html__('Loading user registration workflows...', 'griffinforms-form-builder');
        echo '</div>';
        echo '</div>';
        echo '<div class="griffinforms-accounts-editor-header d-flex align-items-center gap-3 mb-3 d-none">';
        echo '<button type="button" class="griffinforms-accounts-back griffinforms-accounts-back-to-list">';
        echo '<span class="griffinforms-accounts-back-icon">&larr;</span>';
        echo '<span class="griffinforms-accounts-back-text">' . esc_html__('Back', 'griffinforms-form-builder') . '</span>';
        echo '</button>';
        echo '<div class="griffinforms-accounts-active-rule-title text-muted d-none"></div>';
        echo '</div>';
        echo '<div class="griffinforms-accounts-editor-wrapper d-none">';
        echo '<div id="griffinforms-accounts-editor-heading" class="fw-semibold mb-1">' . esc_html__('User Registration', 'griffinforms-form-builder') . '</div>';
        echo '<div id="griffinforms-accounts-editor-description" class="text-muted small mb-3">' . esc_html__('Choose how this form should handle user registration.', 'griffinforms-form-builder') . '</div>';
        echo '<div id="griffinforms-accounts-guided-flow-progress" class="gf-guided-flow-progress-host d-none mb-3"></div>';
        echo '<div id="griffinforms-accounts-editor" class="griffinforms-accounts-editor"></div>';
        echo '<div class="griffinforms-accounts-editor-actions d-flex justify-content-between align-items-center gap-2 mt-4">';
        echo '<div id="griffinforms-accounts-guided-flow-nav" class="gf-guided-flow-nav-host d-none"></div>';
        echo '<div class="griffinforms-accounts-editor-primary-actions d-flex justify-content-end gap-2">';
        echo '<button type="button" id="' . esc_attr((string) $this->getId('cancel_btn')) . '" class="gf-btn gf-btn-secondary" data-bs-dismiss="modal">' . esc_html($this->getCancelButtonLabel()) . '</button>';
        echo '<button type="button" id="' . esc_attr((string) $this->getId('action_btn')) . '" class="gf-btn gf-btn-primary" data-default-label="' . esc_attr($this->getActionButtonLabel()) . '">' . esc_html($this->getActionButtonLabel()) . '</button>';
        echo '</div>';
        echo '</div>';
        echo '</div>';
        echo '</div>';
        echo '</div>';
    }
}
