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";
@Injectable()
export class AddAttachService {
  public static addAttachment = "Services/ERP.svc/REST/ADD_ATTACHMENT";
  constructor(
    public api: ConnectorService,
    public authService: AuthenticationService
  ) {}

  public addAttachment(
    addAttachrequest: any,
    onError?: any,
    errorLabel?: string
  ): Observable<any> {
    const request = addAttachrequest;
    this.authService.authenticateRequest(request);
    return this.api.post(
      AddAttachService.addAttachment,
      request,
      onError,
      errorLabel
    );
  }
}
