// Path: src/main/java/com/aemreunal/helper/ImageProperties.java
// public class ImageProperties {
//     private final String imageFileName;
//     private final int    imageWidth;
//     private final int    imageHeight;
// 
//     public ImageProperties(String imageFileName, int imageWidth, int imageHeight) {
//         this.imageFileName = imageFileName;
//         this.imageWidth = imageWidth;
//         this.imageHeight = imageHeight;
//     }
// 
//     public String getImageFileName() {
//         return imageFileName;
//     }
// 
//     public int getImageWidth() {
//         return imageWidth;
//     }
// 
//     public int getImageHeight() {
//         return imageHeight;
//     }
// }
// 
// Path: src/main/java/com/aemreunal/helper/json/JsonBuilderFactory.java
// public class JsonBuilderFactory {
//     public static JsonObjectBuilder object() {
//         return new JsonObjectBuilder();
//     }
// 
//     public static JsonArrayBuilder array() {
//         return new JsonArrayBuilder();
//     }
// }


import net.minidev.json.JSONObject;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.Size;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.web.bind.annotation.ResponseBody;
import com.aemreunal.helper.ImageProperties;
import com.aemreunal.helper.json.JsonBuilderFactory;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
        // Empty constructor for Spring & Hibernate
    }
    /*
     * END: Constructors
     *------------------------------------------------------------
     */

    /*
     *------------------------------------------------------------
     * BEGIN: Helpers
     */
    public void setImageProperties(ImageProperties imageProperties) {
        this.setMapImageFileName(imageProperties.getImageFileName());
        this.setRegionWidth(imageProperties.getImageWidth());
        this.setRegionHeight(imageProperties.getImageHeight());
    }

    public boolean beaconCoordsAreValid(Beacon beacon) {
        Integer beaconX = beacon.getxCoordinate();
        Integer beaconY = beacon.getyCoordinate();
        boolean xIsValid = beaconX >= 0 && beaconX < this.getRegionWidth();
        boolean yIsValid = beaconY >= 0 && beaconY < this.getRegionHeight();
        return xIsValid && yIsValid;
    }

    public void markAsUpdated() {
        setLastUpdatedDate(new Date());
    }

    public JSONObject getQueryResponse() {
// Path: src/main/java/com/aemreunal/helper/ImageProperties.java
// public class ImageProperties {
//     private final String imageFileName;
//     private final int    imageWidth;
//     private final int    imageHeight;
// 
//     public ImageProperties(String imageFileName, int imageWidth, int imageHeight) {
//         this.imageFileName = imageFileName;
//         this.imageWidth = imageWidth;
//         this.imageHeight = imageHeight;
//     }
// 
//     public String getImageFileName() {
//         return imageFileName;
//     }
// 
//     public int getImageWidth() {
//         return imageWidth;
//     }
// 
//     public int getImageHeight() {
//         return imageHeight;
//     }
// }
// 
// Path: src/main/java/com/aemreunal/helper/json/JsonBuilderFactory.java
// public class JsonBuilderFactory {
//     public static JsonObjectBuilder object() {
//         return new JsonObjectBuilder();
//     }
// 
//     public static JsonArrayBuilder array() {
//         return new JsonArrayBuilder();
//     }
// }


// Path: src/main/java/com/aemreunal/domain/Region.java
import net.minidev.json.JSONObject;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.Size;
import org.springframework.hateoas.ResourceSupport;
import org.springframework.web.bind.annotation.ResponseBody;
import com.aemreunal.helper.ImageProperties;
import com.aemreunal.helper.json.JsonBuilderFactory;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

        // Empty constructor for Spring & Hibernate
    }
    /*
     * END: Constructors
     *------------------------------------------------------------
     */

    /*
     *------------------------------------------------------------
     * BEGIN: Helpers
     */
    public void setImageProperties(ImageProperties imageProperties) {
        this.setMapImageFileName(imageProperties.getImageFileName());
        this.setRegionWidth(imageProperties.getImageWidth());
        this.setRegionHeight(imageProperties.getImageHeight());
    }

    public boolean beaconCoordsAreValid(Beacon beacon) {
        Integer beaconX = beacon.getxCoordinate();
        Integer beaconY = beacon.getyCoordinate();
        boolean xIsValid = beaconX >= 0 && beaconX < this.getRegionWidth();
        boolean yIsValid = beaconY >= 0 && beaconY < this.getRegionHeight();
        return xIsValid && yIsValid;
    }

    public void markAsUpdated() {
        setLastUpdatedDate(new Date());
    }

    public JSONObject getQueryResponse() {
        return JsonBuilderFactory.object()