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

import * as screenfull from 'screenfull';
import {AuthService} from '../../classes/servicess/auth.service';
import {Router} from '@angular/router';
import {Headers, Http} from '@angular/http';
import {Dialog} from '../../classes/base_components/dialog/dialog';

@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,
              private http: Http,
              private dialog: Dialog,
  ) {
    if (this.authService.currentUser) {
      this.name = this.authService.currentUser.name;
    }
  }

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

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