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();
        }
    }

    @POST
    @Path("/change_mode")
    @Consumes({MediaType.APPLICATION_JSON})
    public void switchVent(final VentSwitchPostRequest request) {
        if (request.status.equals("on")) {
            Bathroom.getInstance().turnVentOn();
        }

        else if (request.status.equals("off")) {
            Bathroom.getInstance().turnVentOff();
        }
    }
}

@@ -813,274 +813,206 @@
 lic 
-void switchVent(final VentSwitchPostRequest request) %7B%0A        if (request.status.equals(%22on%22)) %7B%0A            Bathroom.getInstance().turnVentOn();%0A        %7D%0A%0A        else if (request.status.equals(%22off%22)) %7B%0A            Bathroom.getInstance().turnVentOff();%0A        %7D
+VentSwitchPostRequest switchVent(@PathParam(%22house_id%22) String houseid) %7B%0A        VentSwitchPostRequest request = new VentSwitchPostRequest();%0A        request.status = %22ok%22;%0A%0A        return request;
 %0A   

change request parameter type