import { Injectable } from '@angular/core';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';

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


  public static GET_PENDING_REQ_FUNCTIONS = 'Services/ERP.svc/REST/GET_PENDING_REQ_FUNCTIONS';
  public static GET_PENDING_REQ_DETAILS = 'Services/ERP.svc/REST/GET_PENDING_REQ_DETAILS';
  constructor(
    public con: ConnectorService,
    private authService: AuthenticationService,
    public cs: CommonService
  ) { }

  getPendingRequests(request, onError, errorLabel) {
    this.authService.authenticateRequest(request);
    request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName;
    return this.con.postNoLoad(
      ServiceService.GET_PENDING_REQ_FUNCTIONS,
      request,
      onError,
      errorLabel
    );
  }
  getPendingRequestDetails(request, onError, errorLabel) {
    this.authService.authenticateRequest(request);
    request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName;
    return this.con.postNoLoad(
      ServiceService.GET_PENDING_REQ_DETAILS,
      request,
      onError,
      errorLabel
    );
  }




}
