import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class JobdefinitionService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }

  getByJobId(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/JobConfigurationApi/GetByJobId',
    data, { observe: 'response' });
  }

  getFlowChart(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/JobConfigurationApi/GetFlowChart',
    data, {observe: 'response' });
    }
    GetTatFlowByProjectId(projectdefinitionid): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/JobConfigurationApi/GetTatFlowByProjectId?projectdefinitionid='
    + projectdefinitionid, { observe: 'response' });
  }
  addJobWorkflow(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/JobConfigurationApi/AddJobWorkflow',
    data, {observe: 'response' });
  }

  updateJobWorkflow(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/JobConfigurationApi/UpdateJobWorkflow',
    data, {observe: 'response' });
  }
  GetAllByUserId(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/JobConfigurationApi/GetAllByUserId',
    data, {observe: 'response' });
  }
  GetJobWorkFlowDefCount(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/JobConfigurationApi/GetJobWorkFlowDefCount',
    data, {observe: 'response' });
  }
  GetLotMastersByJobId(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/JobConfigurationApi/GetLotMastersByJobId',
    data, {observe: 'response' });
  }
   GetTatFlowByJobId(jobId): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/JobConfigurationApi/GetTatFlowByJobId?jobId=' + jobId, { observe: 'response' });
  }
}
