import { Component, inject, OnInit } from '@angular/core';
import { RouterLink } from '@angular/router';
import { UntilDestroy } from '@ngneat/until-destroy';
import { environment } from '@env/environment';
import { AuthFacade } from '@app/adapters/authentification/auth.facade';

@Component({
  selector: 'app-nav-bar',
  standalone: true,
  imports: [RouterLink],
  templateUrl: './nav-bar.component.html',
  styleUrl: './nav-bar.component.scss',
})
@UntilDestroy()
export class NavBarComponent implements OnInit {
  protected readonly environment = environment;

  protected authFacade = inject(AuthFacade);

  readonly isAuthenticated = this.authFacade.isAuthenticated;
  readonly isEmailVerified = this.authFacade.isEmailVerified;
  readonly user = this.authFacade.user;

  ngOnInit(): void {
    this.authFacade.verifyEmail();
    this.authFacade.verifyAuthenticatedUser();
    this.authFacade.getCurrentUser();
  }
}
