// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { CONSUMER_COMPONENTS_CONST } from '@/domains/consumer/constants';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import {
  IColumn,
  PageDataListComponent,
} from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { consumerPosesNamedRoutes } from '../../constants/routes/poses';
import { IPosResponse } from '../../models';
import { ConsumerPosesService } from '../../services/poses.service';
import { ConsumerPosFormComponent } from './form.component';

@Component({
  selector: 'consumer-poses-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, ConsumerPosFormComponent],
})
export class ConsumerPosesComponent extends AbstractList<IPosResponse> {
  @Input({ required: true }) businessId!: string;
  @Input({ required: true }) complexId!: string;
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = CONSUMER_COMPONENTS_CONST.pos.columns;

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

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

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

  toSinglePage(item: IPosResponse) {
    this.router.navigateByUrl(
      consumerPosesNamedRoutes.pos.meta.pagePath!(this.businessId, this.complexId, item.id),
    );
  }
}
