import { Injectable } from "@angular/core";
import { Http, Response, Headers } from "@angular/http";
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 { WorkListButtonRequest } from "src/app/eit/models/NotificationButtonReq";

@Injectable()
export class WorklistAttachService {
  public static getAttach = "Services/ERP.svc/REST/GET_ATTACHMENTS";
  constructor(
    public api: ConnectorService,
    public authService: AuthenticationService
  ) {}

  public getAttach(
    getAttachReq: WorkListButtonRequest,
    onError?: any,
    errorLabel?: string
  ) {
    const request = getAttachReq;
    this.authService.authenticateRequest(request);
    return this.api.post(
      WorklistAttachService.getAttach,
      request,
      onError,
      errorLabel
    );
  }
}
