// 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 { customerListConfig } from '@/shared/constants/list-configs/customer-list.const';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { ConsumerBusinessActivityFormComponent } from '../components/form-dialog.component';
import { consumerCustomersNamedRoutes } from '../constants';
import { ICustomerResponse } from '../models';
import { CustomersService } from '../services/main.service';

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

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

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

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

  toSinglePage(item: ICustomerResponse) {
    this.router.navigateByUrl(consumerCustomersNamedRoutes.customer.meta.pagePath!(item.id));
  }
}
