import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ProjectMaster } from './projectmaster';
import { environment } from '../../../environments/environment';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class ProjectMasterService {
    baseUrl: string = environment.serviceUrl;
    constructor(private httpClient: HttpClient) { }
    Get(): Observable<any> {
      return this.httpClient.get<any>(this.baseUrl + 'api/ProjectApi');
    }
    Post(projectMaster: ProjectMaster): Observable<any> {
      return this.httpClient.post<any>(this.baseUrl + 'api/ProjectApi/Add', projectMaster, { headers: header, observe: 'response' });
    }
    GetById(projectMaster: ProjectMaster): Observable<any> {
      return this.httpClient.post<any>(this.baseUrl + 'api/ProjectApi/GetById', projectMaster, { headers: header, observe: 'response' });
    }
    Put(projectMaster: ProjectMaster): Observable<any> {
      return this.httpClient.post<any>(this.baseUrl + 'api/ProjectApi/Update', projectMaster, { headers: header, observe: 'response' });
    }
    Delete(projectMaster: ProjectMaster) {
      return this.httpClient.post<any>(this.baseUrl + 'api/ProjectApi/activeordeactive',
      projectMaster, { headers: header, observe: 'response' });
    }
    getActiveProject(): Observable<any> {
      return this.httpClient.get<any>(this.baseUrl + 'api/ProjectApi/GetActiveProject');
    }

  }
