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

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

  constructor(private httpClient: HttpClient) {
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/Miptopic1Api')
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/Miptopic1Api/GetActiveMiptopic1')
  }
  Post(miptopic1: Miptopic1): Observable<any> {

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

}
