// Path: src/main/java/com/maxdemarzi/Exceptions.java
// public class Exceptions extends WebApplicationException {
// 
//     public static final Exceptions invalidInput() {
//         return new Exceptions(400, "Invalid Input");
//     }
// 
//     public Exceptions(int code, String error) {
//         super(new Throwable(error), Response.status(code)
//                 .entity("{\"error\":\"" + error + "\"}")
//                 .type(MediaType.APPLICATION_JSON)
//                 .build());
// 
//     }
// 
// 
// }
// 
// Path: src/main/java/com/maxdemarzi/Properties.java
// public static final String STATUS = "status";


import com.fasterxml.jackson.databind.ObjectMapper;
import com.maxdemarzi.Exceptions;
import java.util.HashMap;
import static com.maxdemarzi.Properties.STATUS;
package com.maxdemarzi.posts;




public class PostValidator {
    private static final ObjectMapper objectMapper = new ObjectMapper();

    static HashMap validate(String body) {
        HashMap input;

        if ( body == null) {
            throw Exceptions.invalidInput();
        }

        // Parse the input
        try {
            input = objectMapper.readValue(body, HashMap.class);
        } catch (Exception e) {
            throw Exceptions.invalidInput();
        }

        if (!input.containsKey(STATUS)) {
            throw PostExceptions.missingStatusParameter();
        } else {
// Path: src/main/java/com/maxdemarzi/Exceptions.java
// public class Exceptions extends WebApplicationException {
// 
//     public static final Exceptions invalidInput() {
//         return new Exceptions(400, "Invalid Input");
//     }
// 
//     public Exceptions(int code, String error) {
//         super(new Throwable(error), Response.status(code)
//                 .entity("{\"error\":\"" + error + "\"}")
//                 .type(MediaType.APPLICATION_JSON)
//                 .build());
// 
//     }
// 
// 
// }
// 
// Path: src/main/java/com/maxdemarzi/Properties.java
// public static final String STATUS = "status";


// Path: src/main/java/com/maxdemarzi/posts/PostValidator.java
import com.fasterxml.jackson.databind.ObjectMapper;
import com.maxdemarzi.Exceptions;
import java.util.HashMap;
import static com.maxdemarzi.Properties.STATUS;

package com.maxdemarzi.posts;




public class PostValidator {
    private static final ObjectMapper objectMapper = new ObjectMapper();

    static HashMap validate(String body) {
        HashMap input;

        if ( body == null) {
            throw Exceptions.invalidInput();
        }

        // Parse the input
        try {
            input = objectMapper.readValue(body, HashMap.class);
        } catch (Exception e) {
            throw Exceptions.invalidInput();
        }

        if (!input.containsKey(STATUS)) {
            throw PostExceptions.missingStatusParameter();
        } else {
            String status = (String)input.get(STATUS);