import { Component, inject } from '@angular/core';
import { Router, RouterLink, RouterLinkActive } from '@angular/router';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faMoon } from '@fortawesome/free-solid-svg-icons';
import { faSun } from '@fortawesome/free-solid-svg-icons';
import { ThemeSwitchService } from '../../service/theme-switch.service';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';

@Component({
  selector: 'app-navigation-bar',
  imports: [FontAwesomeModule, RouterLink, RouterLinkActive, TranslatePipe],
  templateUrl: './navigation-bar.html',
  styleUrl: './navigation-bar.scss'
})
export class NavigationBar {

  private router = inject(Router);
  protected themeSwitchService = inject(ThemeSwitchService);
  protected translateService = inject(TranslateService);

  constructor() {}

  isActive(route: string): boolean {
    return this.router.url === route;
  }

  toggleLanguage(): void {
    this.translateService.use(this.translateService.getCurrentLang() === 'de' ? 'en' : 'de');
  }

  faMoon = faMoon;
  faSun = faSun;

}
