// 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 { Component, inject, Input } from '@angular/core';
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() header: IColumn[] = [
    { field: 'image_url', header: 'تصویر', type: 'thumbnail' },
    { field: 'name', header: 'عنوان' },
    { field: 'sku', header: 'شناسه‌ی عمومی' },
    {
      field: 'category',
      header: 'دسته‌بندی',
      type: 'nested',
      nestedOption: { path: 'category.name' },
    },
    {
      field: 'created_at',
      header: 'تاریخ ایجاد',
      type: 'date',
    },
  ];
  service = inject(GuildGoodsService);

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

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