import LivewireNotification from '../_class/LivewireNotification';
import SmtpSettingsForm from '../_class/SmtpSettingsForm';
import SenderResponseForm from '../_class/SenderResponseForm';

new LivewireNotification();

window.smtpSettingsForm = new SmtpSettingsForm();
window.senderResponseForm = new SenderResponseForm();

Livewire.hook('morphed', ({ component }) => {
    switch (component.name) {
        case 'mail-smtp-settings':
            if (window.smtpSettingsForm) {
                window.smtpSettingsForm.reload(); // Recarga el formulario sin destruir la instancia
            }
            break;

        case 'mail-sender-response-settings':
            if (window.senderResponseForm) {
                window.senderResponseForm.reload(); // Recarga el formulario sin destruir la instancia
            }
            break;

        default:
            break;
    }
});
