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

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

  constructor(private httpClient: HttpClient) {
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/HeadingLevelApi');
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/HeadingLevelApi/GetActiveHeadingLevel');
  }
  Post(headinglevel: HeadingLevel): Observable<any> {

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

}
