{
  "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": "Text input. Type your answer and then submit.",
      "inputType": "Text",
      "validators": [],
      "translatable": true
    }
  },
  "properties": {
    "_supportedLayout": {
      "type": "string",
      "required": true,
      "enum": ["full-width", "half-width", "both"],
      "default": "both",
      "editorOnly": true
    },
    "instruction": {
      "type": "string",
      "required": false,
      "default": "",
      "inputType": "Text",
      "validators": [],
      "help": "This is the instruction text",
      "translatable": true
    },
    "_items": {
      "type": "array",
      "required": true,
      "title": "Input Items",
      "items": {
        "type": "object",
        "required": false,
        "properties": {
          "_answers": {
            "type": "array",
            "required": false,
            "title": "Answers",
            "items": {
              "type": "string",
              "required": true,
              "default": "",
              "title": "Item",
              "inputType": "Text",
              "validators": ["required"],
              "help": "",
              "translatable": true
            }
          },
          "prefix": {
            "type": "string",
            "required": false,
            "default": "",
            "title": "Prefix",
            "inputType": "Text",
            "validators": [],
            "help": "Prefix for this item",
            "translatable": true
          },
          "suffix": {
            "type": "string",
            "required": false,
            "default": "",
            "title": "Suffix",
            "inputType": "Text",
            "validators": [],
            "help": "Suffix for this item",
            "translatable": true
          },
          "placeholder": {
            "type": "string",
            "required": false,
            "default": "",
            "title": "Placeholder",
            "inputType": "Text",
            "validators": [],
            "help": "Hint or expected value of the input field",
            "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": []
    },
    "_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": false,
      "title": "Randomise Items",
      "inputType": "Checkbox",
      "validators": []
    },
    "_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."
    },
    "_questionWeight": {
      "type": "number",
      "required": false,
      "default": 1,
      "title": "Question Weight",
      "inputType": "Number",
      "validators": ["number"],
      "help": "How much this question is worth"
    },
    "_allowsAnyCase": {
      "type": "boolean",
      "required": true,
      "default": false,
      "title": "Allow 'any case' answers",
      "inputType": "Checkbox",
      "validators": [],
      "help": "Should the check of the user's answer(s) be case-insensitive or case-sensitive?"
    },
    "_allowsPunctuation": {
      "type": "boolean",
      "required": true,
      "default": false,
      "title": "Allow Punctuation",
      "inputType": "Checkbox",
      "validators": []
    },
    "_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
        }
      }
    }
  }
}
