import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { FileType } from './filetype';
import { environment } from '../../../environments/environment';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class FiletypeService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }
  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/FileTypeApi');
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/FileTypeApi/GetActiveFileType');
  }
  Post(fileType: FileType): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/FileTypeApi/Add', fileType, { headers: header, observe: 'response' })
  }
  GetById(fileType: FileType): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/FileTypeApi/GetById', fileType, { headers: header, observe: 'response' });
  }
  Put(fileType: FileType): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/FileTypeApi/Update', fileType, { headers: header, observe: 'response' })
  }
  Delete(fileType: FileType) {
    return this.httpClient.post<any>(this.baseUrl + 'api/FileTypeApi/activeordeactive', fileType, { headers: header, observe: 'response' })
  }
  getToExport() {
    return this.httpClient.get<any>(this.baseUrl + 'api/FileTypeApi/GetToExport');
  }
  dataToImport(dataToImport: any) {
    return this.httpClient.post<any>(this.baseUrl + 'api/FileTypeApi/dataToImport', dataToImport, { headers: header, observe: 'response' })
  }
}
