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 { GuildFormComponent } from '../components/form.component';
import { IPartnerResponse } from '../models';
import { PartnersService } from '../services/main.service';

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

  ngOnInit() {
    this.getData();
  }

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