{
    "type": "object",
    "$schema": "http://json-schema.org/draft-04/schema",
    "id": "http://jsonschema.net",
    "$ref": "http://localhost/plugins/content/component/model.schema",
    "globals": {
        "ariaRegion": {
            "type": "string",
            "required": true,
            "default": "Matching. Select from lists and then submit.",
            "inputType": "Text",
            "validators": [],
            "translatable": true
        }
    },
    "properties": {
        "_supportedLayout": {
            "type": "string",
            "required": true,
            "enum": ["full-width", "half-width", "both"],
            "default": "half-width",
            "editorOnly": true
        },
        "instruction": {
            "type": "string",
            "required": false,
            "default": "",
            "inputType": "Text",
            "validators": [],
            "help": "This is the instruction text",
            "translatable": true
        },
        "_attempts": {
            "type": "number",
            "required": true,
            "default": 1,
            "title": "Attempts",
            "inputType": "Number",
            "validators": ["required", "number"],
            "help": "How many attempts the learner is allowed"
        },
        "_canShowModelAnswer": {
            "type": "boolean",
            "required": true,
            "default": true,
            "title": "Display Model Answer",
            "inputType": "Checkbox",
            "validators": [],
            "help": "Allow the user to view the 'model answer' if they answer the question incorrectly?"
        },
        "_canShowFeedback": {
            "type": "boolean",
            "required": true,
            "default": true,
            "title": "Display Feedback",
            "inputType": "Checkbox",
            "validators": []
        },
        "_canShowMarking": {
            "type": "boolean",
            "default": true,
            "title": "Display Marking",
            "inputType": "Checkbox",
            "validators": []
        },
        "_shouldResetAllAnswers": {
            "type": "boolean",
            "required": false,
            "default": true,
            "title": "Reset all answers?",
            "inputType": "Checkbox",
            "validators": [],
            "help": "Controls whether all - or just incorrect - answers should be reset when the question is reset."
        },
        "_shouldDisplayAttempts": {
            "type": "boolean",
            "required": false,
            "default": false,
            "title": "Display Attempts",
            "inputType": "Checkbox",
            "validators": [],
            "help": "Display the number of attempts remaining?"
        },
        "_isRandom": {
            "type": "boolean",
            "required": false,
            "default": true,
            "title": "Randomise answers",
            "inputType": "Checkbox",
            "validators": []
        },
        "_questionWeight": {
            "type": "number",
            "required": false,
            "default": 1,
            "title": "Question Weight",
            "inputType": "Number",
            "validators": ["number"],
            "help": "How much this question is worth"
        },
        "_recordInteraction": {
            "type": "boolean",
            "required": false,
            "default": true,
            "title": "Record interaction",
            "inputType": "Checkbox",
            "validators": [],
            "help": "If disabled, recording the user's answer(s) to this question to cmi.interactions on the LMS will be disabled for this component only."
        },
        "placeholder": {
            "type": "string",
            "required": true,
            "default": "Please select an option",
            "title": "",
            "inputType": "Text",
            "validators": ["required"],
            "help": "Text that will be displayed at the top of each list of options.",
            "translatable": true
        },
        "_items": {
            "type": "array",
            "required": true,
            "title": "Matching Items",
            "items": {
                "type": "object",
                "required": true,
                "properties": {
                    "text": {
                        "type": "string",
                        "required": true,
                        "default": "",
                        "inputType": "Text",
                        "validators": ["required"],
                        "help": "Title text displayed above the matching option",
                        "translatable": true
                    },
                    "_options": {
                        "type": "array",
                        "required": true,
                        "title": "Matching Options",
                        "items": {
                            "type": "object",
                            "required": true,
                            "properties":{
                                "text": {
                                    "type": "string",
                                    "required": true,
                                    "default": "",
                                    "title": "Option Text",
                                    "inputType": "Text",
                                    "validators": ["required"],
                                    "help": "Option text",
                                    "translatable": true
                                },
                                "_isCorrect": {
                                    "type": "boolean",
                                    "required": true,
                                    "default": false,
                                    "title": "Is correct option?",
                                    "inputType": "Checkbox",
                                    "validators": [],
                                    "help": "Defines whether this option is correct or not"
                                }
                            }
                        }
                    }
                }
            }
        },
        "_feedback": {
            "type": "object",
            "required": false,
            "title": "Feedback",
            "properties":{
                "title": {
                    "type": "string",
                    "required": false,
                    "default": "",
                    "title": "Feedback Title",
                    "inputType": "Text",
                    "validators": [],
                    "help": "Leave blank to have the component's title shown instead.",
                    "translatable": true
                },
                "correct": {
                    "type": "string",
                    "required": false,
                    "default": "",
                    "title": "Correct",
                    "inputType": "TextArea",
                    "validators": [],
                    "help": "Correct answer feedback for this question",
                    "translatable": true
                },
                "_incorrect": {
                    "type": "object",
                    "required": false,
                    "title": "Incorrect Feedback",
                    "properties":{
                        "final": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "Incorrect Final",
                            "inputType": "TextArea",
                            "validators": [],
                            "help": "Incorrect answer feedback for the final attempt",
                            "translatable": true
                        },
                        "notFinal": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "Incorrect Not Final",
                            "inputType": "TextArea",
                            "validators": [],
                            "help": "Incorrect answer feedback for any attempt apart from the last attempt. If you leave this blank, the 'Incorrect Final' feedback will be used instead.",
                            "translatable": true
                        }
                    }
                },
                "_partlyCorrect": {
                    "type": "object",
                    "required": false,
                    "properties":{
                        "final": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "Partly Correct Final",
                            "inputType": "TextArea",
                            "validators": [],
                            "help": "Partly correct answer feedback for the final attempt. If you leave this blank, the 'Incorrect Final' feedback will be used instead.",
                            "translatable": true
                        },
                        "notFinal": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "Partly Correct Not Final",
                            "inputType": "TextArea",
                            "validators": [],
                            "help": "Partly correct answer feedback for any attempt apart from the last attempt. If you leave this blank, the 'Partly Correct Final' feedback will be used instead.",
                            "translatable": true
                        }
                    }
                }
            }
        },
        "_buttons": {
            "type": "object",
            "title": "Buttons",
            "required": false,
            "properties":{
                "_submit": {
                    "type": "object",
                    "title": "Submit",
                    "properties":{
                        "buttonText": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Button label text for the submit button",
                            "translatable": true
                        },
                        "ariaLabel": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Aria label for the submit button",
                            "translatable": true
                        }
                    }
                },
                "_reset": {
                    "type": "object",
                    "title": "Reset",
                    "properties":{
                        "buttonText": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Button label text for the reset button",
                            "translatable": true
                        },
                        "ariaLabel": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Aria label for the reset button",
                            "translatable": true
                        }
                    }
                },
                "_showCorrectAnswer": {
                    "type": "object",
                    "title": "Show Correct Answer",
                    "properties":{
                        "buttonText": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Button label text to show the model answer",
                            "translatable": true
                        },
                        "ariaLabel": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Aria label for the show model answer button",
                            "translatable": true
                        }
                    }
                },
                "_hideCorrectAnswer": {
                    "type": "object",
                    "title": "Hide Correct Answer",
                    "properties":{
                        "buttonText": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Button label text to hide the model answer",
                            "translatable": true
                        },
                        "ariaLabel": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Aria label for the hide model answer button",
                            "translatable": true
                        }
                    }
                },
                "_showFeedback": {
                    "type": "object",
                    "title": "Show Feedback",
                    "properties":{
                        "buttonText": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Button label text to show feedback",
                            "translatable": true
                        },
                        "ariaLabel": {
                            "type": "string",
                            "required": false,
                            "default": "",
                            "title": "",
                            "inputType": "QuestionButton",
                            "validators": [],
                            "help": "Aria label for the show feedback button",
                            "translatable": true
                        }
                    }
                },
                "remainingAttemptsText": {
                    "type": "string",
                    "required": false,
                    "default": "",
                    "title": "Attempts Remaining Text",
                    "inputType": "QuestionButton",
                    "validators": [],
                    "help": "Shown when there are multiple attempts left",
                    "translatable": true
                },
                "remainingAttemptText": {
                    "type": "string",
                    "required": false,
                    "default": "",
                    "title": "Final Attempt Text",
                    "inputType": "QuestionButton",
                    "validators": [],
                    "help": "Shown when there is one attempt left",
                    "translatable": true
                }
            }
        }
    }
}
