import { Injectable } from '@angular/core';
import { HttpRequestService } from '../resources/http-request.service';
import { RequestInvoice } from 'src/app/interfaces/acquisition-management/invoice.interface';
import { map } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class InvoiceService {

  private _url: string;
  constructor( private _httpRequestService:HttpRequestService ) {
    this._url = 'acquisition-management/invoice';
  }

  public compareInvoice(requestInvoice: RequestInvoice) {
    return this._httpRequestService.postQuery(`${this._url}/compare-invoice`, requestInvoice).pipe(map((data:any) => data));
  }
  
  public getInvoicePayment() {
    return this._httpRequestService.getQuery(`${this._url}/get-invoice-payment`).pipe(map((data:any) => data));
  }

  public getInvoice() {
    return this._httpRequestService.getQuery(`${this._url}/get-compare-invoice`).pipe(map((data:any) => data));
  }
  
  public getBudgetManagement() {
    return this._httpRequestService.getQuery(`${this._url}/get-budget-management`).pipe(map((data:any) => data));
  }

  public getInvoiceById(id:string) {
    return this._httpRequestService.getQuery(`${this._url}/get-invoice-by-id/${id}`).pipe(map((data:any) => data));
  }
}
