import { IPaginatedResponse } from '@/core/models/service.model';
import { AbstractSelectComponent } from '@/shared/abstractClasses';
import { UikitFieldComponent } from '@/uikit';
import { Component, inject, Input } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { Button } from 'primeng/button';
import { Select } from 'primeng/select';
import { ProviderFormComponent } from '../components/form.component';
import { IProviderResponse } from '../models';
import { ProvidersService } from '../services/main.service';

@Component({
  selector: 'app-provider-select',
  templateUrl: './select.component.html',
  imports: [UikitFieldComponent, Select, Button, ReactiveFormsModule, ProviderFormComponent],
})
export class InventoryBankAccountSelectComponent extends AbstractSelectComponent<
  IProviderResponse,
  IPaginatedResponse<IProviderResponse>
> {
  @Input() override showClear: boolean = false;
  @Input() label: string = '';
  private readonly service = inject(ProvidersService);

  ngOnInit() {
    this.getData();
  }

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