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

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

  constructor(private httpClient: HttpClient) {
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/Miptopic2Api')
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/Miptopic2Api/GetActiveMiptopic2')
  }
  Post(miptopic2: Miptopic2): Observable<any> {

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

}
