import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { HttpHeaders, HttpClient } from '@angular/common/http';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class UserstagemappingService {
  baseUrl: string = environment.serviceUrl;
  constructor(
    private httpClient: HttpClient
  ) { }

  Post(userprojectmapping: any[]): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/StageMappingApi/Add',
      userprojectmapping, { headers: header, observe: 'response' });
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/StageMappingApi');
  }
  getMappedUserList(project_definitionid: any): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/StageMappingApi/GetById/' +
      project_definitionid, { headers: header, observe: 'response' });
  }

  UpdateUserStageOnEmpty(userstagemapping: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/StageMappingApi/UpdateUserStageOnEmpty',
    userstagemapping, { headers: header, observe: 'response' });
  }
  GetProjectMappingUsers(userid: any): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/StageMappingApi/GetProjectMappingUsers/' +
    userid, { headers: header, observe: 'response' });
  }
}
