import { Component, EventEmitter, Output } from '@angular/core';
import { RouterLink } from '@angular/router';
import { ButtonModule } from 'primeng/button';
import { ConfirmationService } from 'primeng/api';

@Component({
  selector: 'app-navbar',
  imports: [RouterLink, ButtonModule],
  templateUrl: './navbar.component.html',
  styleUrl: './navbar.component.scss',
  standalone: true
})
export class NavbarComponent {
  @Output() sidebarToggle = new EventEmitter<void>();
  pageTitle: string = 'Starter Page';
  constructor(private confirmationService: ConfirmationService) {}

  toggleSidebar() {
    this.sidebarToggle.emit();
  }

  confirmarAccion() {
    this.confirmationService.confirm({
      message: '¿Estás seguro de que deseas cerrar sesión?',
      header: 'Cerrar Sesión',
      icon: 'pi pi-sign-out',
      acceptLabel: 'Sí, cerrar',
      rejectLabel: 'Cancelar',
      acceptButtonStyleClass: 'p-button-danger',
      rejectButtonStyleClass: 'p-button-secondary',
      accept: () => {
        console.log('Sesión cerrada');
      },
      reject: () => {
        console.log('Canceló cierre de sesión');
      }
    });
  }
  

}
