// Angular import
import {Component, EventEmitter, inject, OnInit, Output, output} from '@angular/core';
import {CommonModule, DOCUMENT} from '@angular/common';
import {NavContentComponent} from './nav-content/nav-content.component';

// project import

//import { NavContentComponent } from './nav-content/nav-content.component';

@Component({
  selector: 'app-navigation',
  // imports: [ CommonModule],
  templateUrl: './navigation.component.html',
  imports: [
    NavContentComponent
  ],
  styleUrls: ['./navigation.component.scss']
})
export class NavigationComponent implements OnInit{

  private document = inject<Document>(DOCUMENT);

  // media 1025 After Use Menu Open
  NavCollapsedMob = output();

  navCollapsedMob:boolean;
  windowWidth: number | undefined = 1000;

  // Constructor
  constructor() {
    //window.
   // this.windowWidth = !document  ? 0 :  !document.defaultView ? 0 : document.defaultView?.innerWidth;
      //this.windowWidth = document.defaultView !== null? document.defaultView.innerWidth : 1000;//window.innerWidth;
    this.navCollapsedMob = false;
  }

  ngOnInit(): void {
        this.windowWidth = this.document.defaultView?.innerWidth;
    }

  // public method
 // @Output() NavCollapse = new EventEmitter<unknown>();
  @Output() NavCollapse = new EventEmitter<unknown>();
  navCollapseMob() {
    if (!!this.windowWidth && this.windowWidth < 1025) {
      this.NavCollapsedMob.emit();
    }
  }
}
