// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import {
  IColumn,
  PageDataListComponent,
} from '@/shared/components/pageDataList/page-data-list.component';
import { businessActivityListConfig } from '@/shared/constants/list-configs';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { superAdminConsumerBusinessActivitiesNamedRoutes } from '../../constants/routes/businessActivities';
import { IBusinessActivityResponse } from '../../models';
import { AdminConsumerBusinessActivitiesService } from '../../services/businessActivities.service';
import { ConsumerBusinessActivitiesFormComponent } from './form.component';

@Component({
  selector: 'superAdmin-consumer-businessActivities-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, ConsumerBusinessActivitiesFormComponent],
})
export class ConsumerBusinessActivitiesComponent extends AbstractList<IBusinessActivityResponse> {
  @Input({ required: true }) consumerId!: string;
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = businessActivityListConfig.columns;

  private readonly service = inject(AdminConsumerBusinessActivitiesService);
  private readonly router = inject(Router);

  override setColumns(): void {
    this.columns = this.header;
  }

  override getDataRequest() {
    return this.service.getAll(this.consumerId);
  }

  toSinglePage(item: IBusinessActivityResponse) {
    this.router.navigateByUrl(
      superAdminConsumerBusinessActivitiesNamedRoutes.businessActivity.meta.pagePath!(
        this.consumerId,
        item.id,
      ),
    );
  }
}
