import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {environment} from '../../environments/environment';

@Injectable()
export class RestService {
  private currentLocation = environment.location + '/api/v1/resources/';

  constructor(
    private logger: NGXLogger,
    private http: HttpClient
  ) {
  }

  getTrafficLightEvents(tlid) {
    return this.http.get(this.currentLocation + 'traffic_light_events?id=' + tlid, {observe: 'response'});
  }

  getCarEvents(vin) {
    return this.http.get(this.currentLocation + 'car_events?vin=' + vin, {observe: 'response'});
  }

  getTrafficLights() {
    return this.http.get(this.currentLocation + 'traffic_lights');
  }

  getCars() {
    return this.http.get(this.currentLocation + 'cars');
  }

}
