// 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 { consumerBusinessActivityNamedRoutes } from '../constants';
import { IBusinessActivityResponse } from '../models';
import { BusinessActivitiesService } from '../services/main.service';
import { ConsumerBusinessActivityFormComponent } from './form.component';

@Component({
  selector: 'consumer-businessActivity-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, ConsumerBusinessActivityFormComponent],
})
export class ConsumerBusinessActivityListComponent extends AbstractList<IBusinessActivityResponse> {
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = businessActivityListConfig.columns;

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

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

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

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