// 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 { posListConfig } from '@/shared/constants/list-configs';
import { Component, inject, Input } from '@angular/core';
import { Router } from '@angular/router';
import { partnerConsumerPosesNamedRoutes } from '../../constants/routes/poses';
import { IPosResponse } from '../../models';
import { PartnerPosesService } from '../../services/poses.service';
import { ConsumerPosFormDialogComponent } from './form-dialog.component';

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

  private readonly service = inject(PartnerPosesService);
  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(
      partnerConsumerPosesNamedRoutes.pos.meta.pagePath!(
        this.consumerId,
        this.businessId,
        this.complexId,
        item.id,
      ),
    );
  }
}
