// 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 { skuListConfig } from '@/shared/constants/list-configs';
import { Component, computed, inject, Input } from '@angular/core';
import { stockKeepingUnitsNamedRoutes } from '../../constants/routes/stockKeepingUnits';
import { IStockKeepingUnitResponse } from '../../models';
import { StockKeepingUnitsService } from '../../services/stockKeepingUnits.service';
import { StockKeepingUnitFormComponent } from './form.component';

@Component({
  selector: 'admin-guild-stock-keeping-units-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, StockKeepingUnitFormComponent],
})
export class GuildStockKeepingUnitsListComponent extends AbstractList<IStockKeepingUnitResponse> {
  @Input() guildId!: string;
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = skuListConfig.columns;

  listConfig = skuListConfig;
  service = inject(StockKeepingUnitsService);

  allItemsPageRoute = computed(() =>
    stockKeepingUnitsNamedRoutes.stockKeepingUnits.meta.pagePath!(this.guildId),
  );

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

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