import { Injectable } from '@angular/core';
import { ConfigService } from '@shared/config/config.service';
import { HttpClient } from '@angular/common/http';
import { FleioApiService } from '../../fleio-api.service';
import { IBaseFleioObjectModel } from '../../base-model/base-fleio-object.model';
import { Observable } from 'rxjs';
import { IDirectAdminProductModel } from '@fleio-api/plugins/directadmin/model/direct-admin-product.model';
import { IDirectAdminOSModel } from '@fleio-api/plugins/directadmin/model/direct-admin-os.model';

@Injectable({
  providedIn: 'root'
})
export class DirectAdminApiService extends FleioApiService<IBaseFleioObjectModel> {
  // noinspection JSUnusedGlobalSymbols
  constructor(protected httpClient: HttpClient, protected config: ConfigService) {
    super();
    this.setEndpoint(config.getPanelApiUrl('plugins/directadmin/directadmin'));
  }

  getProducts(): Observable<IDirectAdminProductModel[]> {
    return this.getAction('get-products') as Observable<IDirectAdminProductModel[]>;
  }

  getOSList(): Observable<IDirectAdminOSModel[]> {
    return this.getAction('get-os-list') as Observable<IDirectAdminOSModel[]>;
  }
}
