class RestAuthTextInputCallbackHandler extends AbstractRestAuthCallbackHandler<TextInputCallback> {

    public JsonValue convertToJson(TextInputCallback callback, int index) {

        String prompt = callback.getPrompt();
        String defaultText = callback.getDefaultText();
        String text = callback.getText();

        JsonValue jsonValue = JsonValueBuilder.jsonValue()
                .put("type", CALLBACK_NAME)
                .array("output")
                .add(createOutputField("prompt", prompt))
                .addLast(createOutputField("defaultText", defaultText))
                .array("input")
                .addLast(createInputField(index, text))
                .build();

        return jsonValue;
    }

}