import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
    providedIn: 'root'
  })

  export class UploaderService {
    baseUrl: string = environment.serviceUrl;
    constructor(private httpClient: HttpClient) { }

    validateJob(trankey: string): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/UploaderApi/ValidateJob/' + trankey.toString(),
         {observe: 'response' });
    }

    getJobDetails(trankey: string): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/UploaderApi/getJobDetails/' + trankey.toString(),
         {observe: 'response' });
    }

    UploadFile(data: FormData): Observable<any> {
        const headers = new HttpHeaders()
        // .set('Authorization', 'Bearer ' + token);
         return this.httpClient.post<any>(this.baseUrl + 'api/UploaderApi/UploadFile',
           data, { headers: headers, observe: 'response' });
      }

  }