import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ProjectDefinition, StageFollowup } from '../projectconfiguration/projectdefinition';
import { environment } from '../../../environments/environment';
let header = new HttpHeaders();
import { Injectable } from '@angular/core';
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class ProjectConfigurationService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }
  Post(projectDefinition: ProjectDefinition): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/Add',
      projectDefinition, { headers: header, observe: 'response' });
  }
  getByUserId(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetByUserId',
      data, { headers: header, observe: 'response' });
  }
  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ProjectConfigurationApi');
  }
  Put(projectDefinition: ProjectDefinition): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/Update',
      projectDefinition, { headers: header, observe: 'response' });
  }
  GetActiveProjectDefinition(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetActiveProjectDefinition');
  }
  GetProjectWorkflowDef(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetProjectDefWorkflow');
  }
  GetWorkflow(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/WorkFlowApi/GetActiveWorkFlow');
  }
  GetStageFolowup(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetProjDefStageFollowup',
      data, { headers: header, observe: 'response' });
  }
  getFlowChart(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/GetFlowChart',
      data, { observe: 'response' });
  }

  getByIdWithMasterValue(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/GetByIdWithMasterValue',
      data, { observe: 'response' });
  }
  getByIdProjectDefWorkflow(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/GetByIdProjectDefWorkflow',
      data, { observe: 'response' });
  }
  getCurrentFlowProject(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/GetCurrentFlowProject',
      data, { observe: 'response' });
  }
  getCurrentFlowWorkflow(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/GetCurrentFlowWorkflow',
      data, { observe: 'response' });
  }
  PostStageFollowup(data: StageFollowup): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/AddStageFollowup',
      data, { headers: header, observe: 'response' });
  }
  PutStageFollowup(data: StageFollowup): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/EditStageFollowup',
      data, { headers: header, observe: 'response' });
  }
  GetStageFollowupdetail(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetStageFollowup');
  }
  DeleteStageFollowup(department: StageFollowup) {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/DeleteStageFollowup',
      department, { headers: header, observe: 'response' });
  }
  addProjectWorkflow(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/AddProjectWorkflow',
      data, { observe: 'response' });
  }
  updateProjectWorkflow(data: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/ProjectConfigurationApi/UpdateProjectWorkflow',
      data, { observe: 'response' });
  }
  GetTATdetails(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetTAT');
  }
  GetByIdProjectDefWorkflowwithOutline(data: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/ProjectConfigurationApi/GetByIdProjectDefWorkflowwithOutline',
      data, { observe: 'response' });
  }
}
