import { LayoutService } from '@/layout/service/layout.service';
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
import { Component, computed, inject, TemplateRef, ViewChild } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { PARTNER_MENU_ITEMS } from '../constants';
import { PartnerStore } from '../store/main.store';

@Component({
  selector: 'partner-layout',
  templateUrl: './layout.component.html',
  imports: [RouterOutlet, PageLoadingComponent],
})
export class LayoutComponent {
  @ViewChild('topBarMoreAction') topBarMoreAction!: TemplateRef<any>;

  private readonly layoutService = inject(LayoutService);
  private readonly store = inject(PartnerStore);

  readonly loading = computed(() => this.store.loading());

  ngOnInit() {
    this.layoutService.setMenuItems(PARTNER_MENU_ITEMS);
    this.store.getData();
  }
}
