{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "DistanceForm",
    "description": "A json schema used to specify user input forms that can be automatically created using TheDistanceForms library for iOS.",
    "type": "object",
    "required": [
        "title",
        "questions"
    ],
    "properties": {
        "title": {
            "description": "The title for this form.",
            "type": "string"
        },
        "questions": {
            "description": "The questions that make up this forms",
            "type": "array",
            "items": {
                "title": "DistanceFormQuestion",
                "description": "A question entry in a Distance Form",
                "type": "object",
                "required": [
                    "key",
                    "question_type"
                ],
                "properties": {
                    "key": {
                        "description": "The key that uniquely identifies this question in the form. The user's answers for a question will be associated with this key.",
                        "type": "string"
                    },
                    "question_type": {
                        "description": "A string representing the type of this question.",
                        "type": "string",
                        "enum": [
                            "TextSingle",
                            "TextMultiline",
                            "Date",
                            "Time",
                            "DateTime",
                            "ChoiceDropdown",
                            "ChoiceSegments",
                            "Boolean",
                            "Button"
                        ]
                    },
                    "title": {
                        "description": "The title displyed for this question. This is applicable only for question_type ChoiceSegments, Boolean, Button.",
                        "type": "string"
                    },
                    "subtitle": {
                        "description": "",
                        "type": "string"
                    },
                    "prompt": {
                        "description": "",
                        "type": "string"
                    },
                    "keyboard_type": {
                        "description": "",
                        "type": "string",
                        "enum": [
                            "Default",
                            "ASCIICapable",
                            "NumbersAndPunctuation",
                            "URL",
                            "NumberPad",
                            "PhonePad",
                            "NamePhonePad",
                            "EmailAddress",
                            "DecimalPad",
                            "Twitter",
                            "WebSearch"
                        ]
                    },
                    "capitalization": {
                        "description": "",
                        "type": "string",
                        "enum": [
                            "None",
                            "Words",
                            "Sentences",
                            "AllCharacters"
                        ]
                    },
                    "auto_correction": {
                        "description": "",
                        "type": "boolean"
                    },
                    "secure_text_entry": {
                        "description": "",
                        "type": "boolean"
                    },
                    "date_format_style": {
                        "description": "",
                        "type": "string",
                        "enum": [
                            "Short",
                            "Medium",
                            "Long",
                            "Full"
                        ]
                    },
                    "time_formate_style": {
                        "description": "",
                        "type": "string",
                        "enum": [
                            "Short",
                            "Medium",
                            "Long",
                            "Full"
                        ]
                    },
                    "minute_interval": {
                        "description": "",
                        "type": "number",
                        "enum": [
                            1,
                            2,
                            3,
                            4,
                            5,
                            10,
                            12,
                            15,
                            20,
                            30
                        ]
                    },
                    "choices": {
                        "description": "The values the user can choose from in a ChoiceDropdown or ChoiceSegments question.",
                        "type": "array",
                        "minItems": 1,
                        "_uniqueItems": true,
                        "items": {
                            "type": "string"
                        }
                    },
                    "default": {
                        "description": "The default value for a Boolean type question",
                        "type": "boolean"
                    },
                    "validation": {
                        "title": "DistanceFormValidation",
                        "description": "The validation that is associated with this DistanceFormQuestion",
                        "type": "object",
                        "required": [
                            "type",
                            "value_type",
                            "message"
                        ],
                        "properties": {
                            "type": {
                                "description": "The type of validation that will be performed on the user's value for this question.",
                                "type": "string",
                                "enum": [
                                    "NotEmpty",
                                    "Email",
                                    "Number",
                                    "Postcode",
                                    "Regex"
                                ]
                            },
                            "value_type": {
                                "description": "The type of value that the validation is expected to be performed on.",
                                "type": "string",
                                "enum": [
                                    "String",
                                    "Date",
                                    "Boolean",
                                    "Number"
                                ]
                            },
                            "message": {
                                "description": "The error message the user will see if this validation fails.",
                                "type": "string"
                            },
                            "regex": {
                                "description": "The regular expression to test for validation.",
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    }
}