class SnsPushMessageConverter implements PushMessageConverter {

    @Override
    public String toTransferFormat(PushMessage message) {

        JsonValue gcm = json(object(
                field(GCM_PRIORITY, GCM_HIGH_PRIORITY),
                field(GCM_DATA, object(
                        field(GCM_MESSAGE, message.getBody()),
                        field(MESSAGE_ID, message.getMessageId())))));

        JsonValue apple = json(object(
                field(APNS_APS, object(
                        field(APNS_ALERT, message.getSubject()),
                        field(APNS_SOUND, APNS_DEFAULT_SOUND),
                        field(MESSAGE_ID, message.getMessageId()),
                        field(APNS_DATA, message.getBody()),
                        field(APNS_CONTENT_AVAILABLE, APNS_CONTENT_AVAILABLE_TRUE)))));

        JsonValue toSend = json(object(
                field(DEFAULT, message.getSubject()),
                field(GCM, gcm.toString()),
                field(APNS, apple.toString()),
                field(APNS_SANDBOX, apple.toString())
        ));

        return toSend.toString();
    }

}