import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { NewVisitor } from '../../entity/NewVisitor';
import { CrudService } from './crud.service';
import { first, map } from 'rxjs/operators';
import { Log } from '../../entity/Log';

const BASE_URL = (action: string = null) => { return `Log${(action ? `/${action}` : '')}` }
const POST_URL_PURGE_BEFORE = 'Log/PurgeBefore'


@Injectable({
  providedIn: 'root'
})
export class LogService extends CrudService<Log> {

  constructor(protected http: HttpClient) {
    super(http, BASE_URL);
  }
  purgeBefore(data: Date) {
    return this.http.post<boolean>(POST_URL_PURGE_BEFORE,
      JSON.stringify(data), {
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
    });
  }

}
