import { IListingResponse } from '@/core/models/service.model';
import ISummary from '@/core/models/summary';
import { AbstractSelectComponent } from '@/shared/abstractClasses';
import { UikitFieldComponent } from '@/uikit';
import { Component, inject, Input } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { Select } from 'primeng/select';
import { CatalogsService } from '../../service';

@Component({
  selector: 'catalog-guild-select',
  templateUrl: './select.component.html',
  imports: [UikitFieldComponent, Select, ReactiveFormsModule],
})
export class CatalogGuildSelectComponent extends AbstractSelectComponent<
  ISummary,
  IListingResponse<ISummary>
> {
  @Input() override showClear: boolean = false;
  @Input({ required: true }) name!: string;
  @Input() label: string = '';
  private readonly service = inject(CatalogsService);

  ngAfterViewInit() {
    this.getData();
  }

  getDataService() {
    return this.service.getGuilds();
  }
}
