// 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 { ConsumerAccountPermissionListComponent } from '../../components/permissions/list.component';
import { consumerAccountPermissionsNamedRoutes } from '../../constants/routes/permissions';
import { AccountStore } from '../../store/account.store';

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

  private readonly accountStore = inject(AccountStore);

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

  account = computed(() => this.accountStore.entity());

  ngAfterViewInit() {
    this.setBreadcrumb();
  }

  setBreadcrumb() {
    this.breadcrumbService.setItems([
      ...this.accountStore.breadcrumbItems(),
      consumerAccountPermissionsNamedRoutes.permissions.meta,
    ]);
  }
}
