import {Injectable} from '@angular/core';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { Observable } from 'rxjs';
import {AbsenceTransaction} from '../models/absence.transaction'
import {AbsenceAttahcmentResponse} from '../models/abs.attach.response'

@Injectable()
export class AbsenceListService {
  public static getAbsenceTransaction='Services/ERP.svc/REST/GET_ABSENCE_TRANSACTIONS';
  public static getAbsenceAttachment='Services/ERP.svc/REST/GET_ABSENCE_ATTACHMENTS';
    constructor(
      public api: ConnectorService,
      public authService: AuthenticationService,
  
    ) { }
  
    public getAbsenceList(absence: any, onError?: any, errorLabel?: string): Observable<AbsenceTransaction> {
      const request = absence;
      this.authService.authenticateRequest(request);
      return this.api.post(AbsenceListService.getAbsenceTransaction, request, onError, errorLabel);
    }
    public getAbsenceAttachment(absence: any, onError?: any, errorLabel?: string): Observable<AbsenceAttahcmentResponse> {
      const request = absence;
      this.authService.authenticateRequest(request);
      return this.api.post(AbsenceListService.getAbsenceAttachment, request, onError, errorLabel);
    }

}