
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { Observable } from 'rxjs';
import { HttpHeaders, HttpClient } from '@angular/common/http';
import { Toolset } from './toolset';

@Injectable({
  providedIn: 'root'
})
export class ToolsetService {
  baseUrl: string = environment.serviceUrl;

  constructor(private httpClient: HttpClient) {
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ToolsetApi');
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/ToolsetApi/GetActiveToolset');
  }
  Post(toolset: Toolset): Observable<any> {

    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/ToolsetApi/add', toolset, { headers: header, observe: 'response' });
  }
  Delete(toolset: Toolset) {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/ToolsetApi/activeordeactive',
      toolset, { headers: header, observe: 'response' });
  }
  Put(toolset: Toolset): Observable<any> {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/ToolsetApi/Update', toolset, { headers: header, observe: 'response' });
  }

}
