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-deviceBrand-select',
  templateUrl: '../../template.html',
  imports: [UikitFieldComponent, Select, ReactiveFormsModule],
})
export class CatalogDeviceBrandSelectComponent extends AbstractSelectComponent<
  ISummary,
  IListingResponse<ISummary>
> {
  @Input() override showClear: boolean = false;
  @Input() label: string = '';
  private readonly service = inject(CatalogsService);

  get preparedLabel() {
    return this.label || 'انتخاب برند دستگاه';
  }

  ngOnInit() {
    this.getData();
  }

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