package ge.edu.freeuni.sdp.iot.simulator.bath.service;

import ge.edu.freeuni.sdp.iot.simulator.bath.jaxb.LightSwitchPostRequest;
import ge.edu.freeuni.sdp.iot.simulator.bath.jaxb.VentSwitchPostRequest;
import ge.edu.freeuni.sdp.iot.simulator.bath.model.Bathroom;

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

public class BathroomService {


    @POST
    @Path("/light-switch")
    @Consumes({MediaType.APPLICATION_JSON})
    public void switchLight(final LightSwitchPostRequest request) {
        if (request.status.equals("ON")) {
            Bathroom.getInstance().turnLightOn();
        }
        else if (request.status.equals("OFF")) {
            Bathroom.getInstance().turnLightOff();
        }
    }

    @GET
    @Path("/change_mode/mode")
    @Consumes({MediaType.APPLICATION_JSON})
    @Produces( { MediaType.APPLICATION_JSON})
    public VentSwitchPostRequest get(@PathParam("change_mode") String houseid) {
        VentSwitchPostRequest request = new VentSwitchPostRequest();
        request.status = "ok";

        return request;
    }
}

@@ -314,16 +314,50 @@
 diaType;
+%0Aimport javax.ws.rs.core.Response;
 %0A%0Apublic
@@ -844,85 +844,27 @@
     
-@Produces( %7B MediaType.APPLICATION_JSON%7D)%0A    public VentSwitchPostRequest ge
+public Response pos
 t(@P
@@ -898,19 +898,18 @@
 ing 
-houseid
+mode
 ) %7B%0A
+//
     
@@ -969,24 +969,232 @@
 tRequest();%0A
+//%0A//        if (mode.equals(%22ON%22)) %7B%0A//            Bathroom.getInstance().turnVentOn();%0A//        %7D%0A//        else if (mode.equals(%22OFF%22)) %7B%0A//            Bathroom.getInstance().turnVentOff();%0A//        %7D%0A//
         requ
@@ -1228,23 +1228,37 @@
  return 
-request
+Response.ok().build()
 ;%0A    %7D%0A

add simple service