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

@Injectable({
  providedIn: 'root'
})
export class FileModeService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }

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

}
