import {Component, ElementRef, EventEmitter, Output, ViewChild} from '@angular/core';

import * as screenfull from 'screenfull';
import {Router} from '@angular/router';
import {AuthService} from '../../public/services/auth.service';


@Component({
  selector: 'app-header',
  templateUrl: './header.component.html'
})
export class HeaderComponent {

  @Output() toggleSidenav = new EventEmitter<void>();
  @Output() toggleNotificationSidenav = new EventEmitter<void>();
  name = '';

  constructor(private authService: AuthService, private router: Router) {


    this.authService.currentUser.subscribe(user => {
      if (user)
        this.name = user.getName();
    });


  }

  fullScreenToggle(): void {
    if (screenfull.enabled) {
      screenfull.toggle();
    }
  }

  logout() {
    this.authService.logout();

  }
}
