class RestAuthNameCallbackHandler extends AbstractRestAuthCallbackHandler<NameCallback> {

    public JsonValue convertToJson(NameCallback callback, int index) {

        String prompt = callback.getPrompt();
        String name = callback.getName();

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

        return jsonValue;
    }

}