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

@Injectable({providedIn: 'root'})
export class ReservationService extends DynaDataService {
    constructor(private httpClient: HttpClient) {
        super(httpClient);
    }

    edit(data: any, id: any): Observable<object> {
        this.serviceURL = '/service/reservations/edit';
        return super.update(id, data);
    }

    create(data: any): Observable<object> {
        this.serviceURL = '/service/reservations/create';
        return super.create(data);
    }

    getResultList(serviceURL?: string) {
        this.serviceURL = '/service/reservations';
        return super.getResultList(serviceURL);
    }

    getResult(id: any): Observable<object> {
        this.serviceURL = '/service/reservations';
        return super.getResult(id);
    }

    getById(id: any): Observable<any> {
        this.serviceURL = '/service/reservations';
        return this.httpClient.get<any>(`${this.serviceURL}/${id}`);
    }

}
