{
  "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": "Accordion. Select each button to expand the content.",
      "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
    },
    "_setCompletionOn": {
      "type": "string",
      "required": false,
      "default": "allItems",
      "title": "Set completion on:",
      "enum": ["inview", "allItems"],
      "inputType": {
        "type": "Select",
        "options": ["inview", "allItems"]
      },
      "validators": [],
      "help": "Whether completion is based on the learner having viewed all the accordion items - or just having viewed the component"
    },
    "_items": {
      "type": "array",
      "required": true,
      "title": "Items",
      "items": {
        "type": "object",
        "required": true,
        "properties": {
          "title": {
            "type": "string",
            "required": true,
            "inputType": "Text",
            "title": "Item Title",
            "default": "",
            "validators": ["required"],
            "help": "This is the item title",
            "translatable": true
          },
          "body": {
            "type": "string",
            "required": true,
            "inputType": "TextArea",
            "title": "Item Body",
            "default": "",
            "validators": ["required"],
            "help": "This is the item body text that is hidden until the item title is clicked on",
            "translatable": true
          },
          "_graphic": {
            "type": "object",
            "required": false,
            "title": "Graphic",
            "properties":{
              "alt": {
                "type": "string",
                "required": false,
                "default": "",
                "inputType": "Text",
                "validators": [],
                "help": "The alternative text for this image",
                "translatable": true
              },
              "src": {
                "type": "string",
                "required": false,
                "default": "",
                "inputType": "Asset:image",
                "validators": [],
                "help": "Optional image which will be rendered with the item body text"
              },
              "attribution": {
                "type":"string",
                "required": false,
                "default": "",
                "inputType": "Text",
                "validators": [],
                "help": "Text to be displayed as an attribution",
                "translatable": true
              }
            }
        },
          "_classes": {
            "type":"string",
            "required": false,
            "default": "",
            "title": "Classes",
            "inputType": "Text",
            "validators": [],
            "help": "Classes that are applied to the accordion item"
          }
        }
      }
    },
    "_shouldCollapseItems": {
      "type": "boolean",
      "required": false,
      "default": true,
      "title": "Items should auto-collapse",
      "inputType": "Checkbox",
      "validators": [],
      "help": "If disabled, upon expansion of an accordion item, any previously expanded items will not be collapsed"
    }
  }
}
