import { Component } from '@angular/core';
import { ActivatedRoute, ChildrenOutletContexts, RouterOutlet } from '@angular/router';
import { AnimationRouteComponent, slideInAnimation } from '../../../animations';
import { CommonNzModule } from '../../../common.nz.module';
import { HeaderComponent } from './header/header.component';
import { ManagerLayoutService } from './layout.service';
import { SidebarComponent } from './sidebar/sidebar.component';

@Component({
  selector: 'manager-layout',
  standalone: true,
  imports: [CommonNzModule, HeaderComponent, SidebarComponent, RouterOutlet],
  templateUrl: './layout.component.html',
  styleUrl: './layout.component.less',
  host: {
    class: 'custom-scroll-bar overflow-y-auto',
  },
  animations: [slideInAnimation],
})
export class LayoutComponent extends AnimationRouteComponent {
  constructor(
    private service: ManagerLayoutService,
    private contexts: ChildrenOutletContexts,
    private route: ActivatedRoute
  ) {
    super();
  }
  get sideCollapsed() {
    return this.service.sideCollapsed();
  }
  get sideWidth() {
    return this.service.sideWidth;
  }
  get sideWidthPixel() {
    return this.service.sideWidthPixel;
  }
  toggleSidebar() {
    this.service.toggleSidebar();
  }
}
