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

@Injectable({
  providedIn: 'root'
})
export class EstimatedInstanceRevenueService extends FleioApiService<any> {
  constructor(protected httpClient: HttpClient, protected config: ConfigService) {
    super();
    this.setEndpoint(config.getPanelApiUrl('reports/estimated-instance-revenue'));
  }

  getEstimatedInstanceRevenue(): Observable<any> {
    return this.getAction('get_estimated_instance_revenue');
  }

  getReportForRegion(regionName: string): Observable<any> {
    return this.getAction('get_report_for_region', {
      region_name: regionName,
    });
  }

  combineRegionReports(reports): Observable<any> {
    return this.postAction('combine_region_reports', {region_reports: reports});
  }
}
