import { Injectable } from '@angular/core';
import { HttpRequestService } from '../resources/http-request.service';
import { map } from 'rxjs';

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

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

  public getOrderReception() {
    return this._httpRequestService.getQuery(`${ this._url }/get-order-reception`).pipe(map((data:any) => data));
  }
  public getListArtitleReception(orderNumber:string) {
    return this._httpRequestService.getQuery(`${ this._url }/get-list-artitle-reception/${orderNumber}`).pipe(map((data:any) => data));
  }
  public getInformartionArtitleToEquipment(orderNumber:string, information:string) {
    return this._httpRequestService.getQuery(`${ this._url }/get-information-artitle-equipment/${orderNumber}/${information}`).pipe(map((data:any) => data));
  }
  public generateSheetDeliveryListXLS(orderNumber:string) {
    return this._httpRequestService.getQuery(`${ this._url }/generate-sheet-delivery-list-xls/${orderNumber}`).pipe(map((data:any) => data));
  }
  public generateSheetDeliveryListPDF(orderNumber:string) {
    return this._httpRequestService.getQuery(`${ this._url }/generate-sheet-delivery-list-pdf/${orderNumber}`).pipe(map((data:any) => data));
  }
}
