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

@Injectable({
  providedIn: 'root'
})
export class SupplementService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }
  GetChapterDetailsbyJobid(jobid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/GetChapterDetailsbyJobid/' + jobid);
  }
  Getjobstatecount(jobid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/Getjobstatecount/' + jobid);
  }
  GetSupplementByJobid(issupplement: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/getsupplementJobid/' + issupplement);
  }
  GetByIssupplement(jobid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/GetByIssupplement/' + jobid, { observe: 'response' });
  }
  GetisProcessing(jobid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/GetisProcessing/' + jobid);
  }
  GetisProcessing2(jobid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/GetisProcessing2/' + jobid);
  }
  Finalsubmission(jobid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/Finalsubmission/' + jobid);
  }
  PostBatch(batch: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/LotBatchApi/PostBatch', batch, { observe: 'response' });
  }
  PostBatchDetails(batchDetails: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/LotBatchApi/Savesupplement', batchDetails, { observe: 'response' });
  }
  Updatesupp(batchDetails: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/LotBatchApi/updatesupplement', batchDetails, { observe: 'response' });
  }
  Getsuppview(jobid: number, batchid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/LotBatchApi/Getsuppview/' + jobid + '/' + batchid, { observe: 'response' });
  }
  GetProductionWorkflow(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ProductionWorkFlowApi', { observe: 'response' });
  }
  GetAllSupplementType(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/SupplementTypeApi', { observe: 'response' });
  }
  MovetoPagination(batchdetails: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/LotBatchApi/MovetoPagination', batchdetails, { observe: 'response' });
  }
}
