import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { environment } from '../../environments/environment';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');

@Injectable({
    providedIn: 'root'
})

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

    getUserProjectStatusDetails(data: any): Observable<any> {
        debugger;
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/getUserProjectStatusDetails',
            data, { headers: header, observe: 'response' });
    }
    getJobNo(data: any): Observable<any> {
        debugger;
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/getJobNo',
            data, { headers: header, observe: 'response' });
    }
    loadStageDetails(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/loadStageDetails',
            data, { headers: header, observe: 'response' });
    }
    getMailBoxDetails(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/getMailBoxDetails',
            data, { headers: header, observe: 'response' });
    }
    getLoadType(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/getLoadType',
            data, { headers: header, observe: 'response' });
    }
    getProjectJobDetails(data: any): Observable<any> {
        debugger;
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/getProjectJobDetails',
            data, { headers: header, observe: 'response' });
    }
    jobBackForward(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/jobBackForward',
            data, { headers: header, observe: 'response' });
    }
    geterror(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/geterror',
            data, { headers: header, observe: 'response' });
    }

    getReadyYTS(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/getReadyYTS',
            data, { headers: header, observe: 'response' });
    }
    PostUpdateLotTransaction(data): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/WorkAreaApi/PostUpdatelot_transaction',
            data, { headers: header, observe: 'response' });
    }
    Delete(data: any) {
        return this.httpClient.post(this.baseUrl + 'api/DashboardApi/activeordeactive', data, { headers: header, observe: 'response' });
    }
    UpdateMailbox(fileType: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/UpdateMailbox', fileType,
            { headers: header, observe: 'response' });
    }
    GetJobStatusreport(jobid: number): Observable<any> {
        return this.httpClient.get<any>(this.baseUrl + 'api/DashboardApi/GetJobStatusreport/' + jobid, { observe: 'response' });
    }
    GetSupplementlotdetails(batchid: number): Observable<any> {
        return this.httpClient.get<any>(this.baseUrl + 'api/DashboardApi/GetSupplementlotdetails/' + batchid, { observe: 'response' });
    }
    Getusers(prodefid:number):Observable<any>{
        return this.httpClient.get<any>(this.baseUrl+'api/DashboardApi/getuserbyprodefid/'+ prodefid,{observe :'response'});
    }
    getCheckincur(data: FormData): Observable<any> {
        const headers = new HttpHeaders()
        return this.httpClient.post<any>(this.baseUrl + 'api/WorkAreaApi/getCheckincur',
          data, { headers: headers, observe: 'response' });
      }
    getlotmeta(data: any): Observable<any> {
        return this.httpClient.post<any>(this.baseUrl + 'api/LotApi/Getlotmeta',
        data, { headers: header,observe: 'response' });
      }
      Get_all(): Observable<any> {
        return this.httpClient.get<any>(this.baseUrl + 'api/CategoryApi/Getall', {  observe: 'response' });
      }
      recorderror(data: FormData): Observable<any> {
        const headers = new HttpHeaders()
        return this.httpClient.post<any>(this.baseUrl + 'api/WorkAreaApi/Recorderror',
          data, { headers: headers, observe: 'response' });
      }
      
 manualcheckout(data){
    return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/manualcheckout',
        data, { headers: header, observe: 'response' });
  }


forwardstage(data){
    debugger;
    return this.httpClient.post<any>(this.baseUrl + 'api/DashboardApi/forwardstage',
        data, { headers: header, observe: 'response' });
  }

}
