import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

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

  private urlPayment: string = "http://localhost:9077/AVB/service/payment";
  private urlItinerary: string = "http://localhost:9077/AVB/service/itinerarys";


  constructor(private httpClient: HttpClient) { }

  addPayment(query: any): Observable<any> {
    return this.httpClient.post<any>(this.urlPayment + "/", query);
  }

  addPaymentToReservation(id: number, query: any): Observable<Object> {
    return this.httpClient.post(`${this.urlPayment + "/reservations"}/${id}/payments`, query);
  }

  updateStatusReservation(id: number, query: any): Observable<Object> {
    return this.httpClient.put(`${this.urlItinerary + "/update"}/${id}`, query);
  }
}
