// 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 { ConsumerBusinessActivityGoodsListComponent } from '../../components/goods/list.component';
import { consumerBusinessActivityGoodsNamedRoutes } from '../../constants/routes/goods';
import { BusinessActivityStore } from '../../store/businessActivity.store';

@Component({
  selector: 'consumer-businessActivity-goods',
  templateUrl: './list.component.html',
  imports: [ConsumerBusinessActivityGoodsListComponent],
})
export class ConsumerBusinessActivityGoodsComponent {
  private readonly route = inject(ActivatedRoute);
  private readonly breadcrumbService = inject(BreadcrumbService);

  private readonly businessStore = inject(BusinessActivityStore);

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

  business = computed(() => this.businessStore.entity());

  ngOnInit() {
    this.setBreadcrumb();
  }

  setBreadcrumb() {
    this.breadcrumbService.setItems([
      ...this.businessStore.breadcrumbItems(),
      {
        title: consumerBusinessActivityGoodsNamedRoutes.goods.meta.title,
        routerLink: consumerBusinessActivityGoodsNamedRoutes.goods.meta.pagePath!(
          this.businessId(),
        ),
      },
    ]);
  }
}
