// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { BreadcrumbService } from '@/core/services';
import pageParamsUtils from '@/utils/page-params.utils';
import { Component, computed, inject, signal } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ConsumerPosesComponent } from '../../components/poses/list.component';
import { consumerPosesNamedRoutes } from '../../constants/routes/poses';
import { BusinessActivityStore } from '../../store/businessActivity.store';
import { ConsumerComplexStore } from '../../store/complex.store';

@Component({
  selector: 'consumer-complex-pos-list-page',
  templateUrl: './list.component.html',
  imports: [ConsumerPosesComponent],
})
export class ConsumerPosListPageComponent {
  private readonly route = inject(ActivatedRoute);
  private readonly breadcrumbService = inject(BreadcrumbService);
  private readonly businessStore = inject(BusinessActivityStore);
  private readonly complexStore = inject(ConsumerComplexStore);

  pageParams = computed(() => pageParamsUtils(this.route));
  businessId = signal<string>(this.pageParams()['businessActivityId']);
  complexId = signal<string>(this.pageParams()['complexId']);

  ngOnInit() {
    this.setBreadcrumb();
  }

  setBreadcrumb() {
    this.breadcrumbService.setItems([
      ...this.businessStore.breadcrumbItems(),
      ...this.complexStore.breadcrumbItems(),
      {
        title: consumerPosesNamedRoutes.poses.meta.title,
        routerLink: consumerPosesNamedRoutes.poses.meta.pagePath!(
          this.businessId(),
          this.complexId(),
        ),
      },
    ]);
  }
}
