// 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 { saleInvoiceListConfig } from '@/shared/constants/list-configs';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { consumerSaleInvoicesNamedRoutes } from '../constants/routes';
import { IConsumerSaleInvoicesResponse } from '../models';
import { ConsumerSaleInvoicesService } from '../services/main.service';

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

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

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

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

  toSinglePage(item: IConsumerSaleInvoicesResponse) {
    this.router.navigateByUrl(consumerSaleInvoicesNamedRoutes.saleInvoice.meta.pagePath!(item.id));
  }
}
