import { Injectable } from '@angular/core';
import { ConfigService } from '@shared/config/config.service';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { FleioApiService } from '@fleio-api/fleio-api.service';
import { FleioId } from '@fleio-api/base-model/base-fleio-object.model';

@Injectable({
  providedIn: 'root'
})
export class OpenstackBillingServicesApiService extends FleioApiService<any> {
  constructor(protected httpClient: HttpClient, protected config: ConfigService) {
    super();
    this.setEndpoint(config.getPanelApiUrl('openstack/billing/services'));
  }

  createOpenstackService(parameters: Record<string, any>): Observable<any> {
    return this.postAction( 'create_openstack_service', parameters,);
  }

  getOpenstackServices(clientId: FleioId): Observable<any> {
    return this.getAction( 'openstack_services', {client_id: clientId});
  }

  getNewServiceData(clientId: FleioId): Observable<any> {
    return this.getAction('new_service_data', {client_id: clientId});
  }

}
