// 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 { goodListConfig } from '@/shared/constants/list-configs';
import { Component, computed, inject, Input } from '@angular/core';
import { guildGoodsNamedRoutes } from '../../constants/routes/goods';
import { IGuildGoodsResponse } from '../../models';
import { GuildGoodsService } from '../../services/goods.service';
import { GuildGoodFormComponent } from './form.component';

@Component({
  selector: 'admin-guild-goods-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, GuildGoodFormComponent],
})
export class GuildGoodsListComponent extends AbstractList<IGuildGoodsResponse> {
  @Input() guildId!: string;
  @Input() fullHeight?: boolean;
  @Input() showAllBtn?: boolean;
  @Input() header: IColumn[] = goodListConfig.columns;

  listConfig = goodListConfig;
  service = inject(GuildGoodsService);

  showAllPageRoute = computed(() => guildGoodsNamedRoutes.goods.meta.pagePath!(this.guildId));

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

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