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

@Injectable({
  providedIn: 'root',
})
export class HeatTemplateVersionsApiService extends FleioApiService<IHeatTemplateVersionModel> {
  constructor(protected httpClient: HttpClient, protected config: ConfigService) {
    super();
    this.setEndpoint(config.getPanelApiUrl('openstack/heat-template-versions'));
  }

  details(objectId: FleioId): Observable<IHeatTemplateVersionModel> {
    return super.getAction('retrieve', {name: objectId});
  }
}
