package io.senslog.ws.handler;

import io.senslog.manager.ObservationManager;

import javax.ws.rs.*;
import javax.ws.rs.core.Response;

import static javax.ws.rs.core.MediaType.APPLICATION_JSON;

@Path("/v1/FeederServlet")
public class FeederHandler {

    private final ObservationManager observationManager;

    public FeederHandler() {
        this.observationManager = ObservationManager.newInstance();
    }

    @POST @Produces(APPLICATION_JSON)
    public Response handlePostOperation(
            @QueryParam("Operation") String operationType,
            @QueryParam("value")     String value,
            @QueryParam("date")      String timestamp,
            @QueryParam("unit_id")   String unitId,
            @QueryParam("sensor_id") String sensorId
    ) {
        return Response.ok().build();
    }

    @GET @Produces(APPLICATION_JSON)
    public Response handleGetOperation(
            @QueryParam("Operation") String operationType,
            @QueryParam("value")     String value,
            @QueryParam("date")      String timestamp,
            @QueryParam("unit_id")   String unitId,
            @QueryParam("sensor_id") String sensorId
    ) {
        return Response.ok().build();
    }

    private Response insertObservation() {
        return null;
    }
}
