class RestAuthTextOutputCallbackHandler extends AbstractRestAuthCallbackHandler<TextOutputCallback> {

    public JsonValue convertToJson(TextOutputCallback callback, int index) {

        final String message = callback.getMessage();
        final int messageType = callback.getMessageType();

        final JsonValue jsonValue = JsonValueBuilder.jsonValue()
                .put("type", CALLBACK_NAME)
                .array("output")
                .add(createOutputField("message", message))
                .addLast(createOutputField("messageType", String.valueOf(messageType)))
                .build();

        return jsonValue;
    }

}