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

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

  constructor(private httpClient: HttpClient) {
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/PrintSupplementApi');
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/PrintSupplementApi/GetActivePrintSupplement')
  }
  Post(printsupplement: PrintSupplement): Observable<any> {

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

}
