// 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 { complexListConfig } from '@/shared/constants/list-configs';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { superAdminConsumerComplexesNamedRoutes } from '../../constants/routes/complexes';
import { IComplexResponse } from '../../models';
import { AdminComplexesService } from '../../services/complexes.service';
import { ConsumerComplexFormComponent } from './form.component';

@Component({
  selector: 'superAdmin-consumer-complexes-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, ConsumerComplexFormComponent],
})
export class ConsumerComplexesComponent extends AbstractList<IComplexResponse> {
  @Input() consumerId!: string;
  @Input() businessId!: string;
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = complexListConfig.columns;

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

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

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

  toSinglePage(item: IComplexResponse) {
    this.router.navigateByUrl(
      superAdminConsumerComplexesNamedRoutes.complex.meta.pagePath!(
        this.consumerId,
        this.businessId,
        item.id,
      ),
    );
  }
}
