{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.schemastore.org/gadget-yaml.json",
  "title": "gadget.yaml",
  "description": "Schema for Revel Digital gadget.yaml files. See https://developer.reveldigital.com/gadgets for more information.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "title": {
      "type": "string"
    },
    "title_url": {
      "type": ["string", "null"],
      "format": "uri"
    },
    "description": {
      "type": "string"
    },
    "author": {
      "type": "string"
    },
    "background": {
      "type": "string"
    },
    "requirements": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "locales": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Locale"
      }
    },
    "prefs": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Pref"
      }
    }
  },
  "required": [
    "author",
    "background",
    "description",
    "locales",
    "prefs",
    "requirements",
    "title",
    "title_url"
  ],
  "definitions": {
    "Locale": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "messages": {
          "type": "string",
          "format": "uri"
        },
        "lang": {
          "type": "string"
        }
      },
      "required": ["messages"],
      "title": "Locale"
    },
    "Pref": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "datatype": {
          "type": "string"
        },
        "default_value": {
          "$ref": "#/definitions/DefaultValue"
        },
        "required": {
          "type": "boolean"
        },
        "options": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Option"
          }
        },
        "depends": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Depend"
          }
        },
        "multiple": {
          "type": "boolean"
        },
        "multiline": {
          "type": "boolean"
        }
      },
      "required": [
        "datatype",
        "default_value",
        "display_name",
        "name",
        "required"
      ],
      "title": "Pref"
    },
    "Depend": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "any_of": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/AnyOf"
          }
        },
        "all_of": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/AllOf"
          }
        },
        "none_of": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/NoneOf"
          }
        }
      },
      "required": ["name"],
      "title": "Depend"
    },
    "AnyOf": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["values"],
      "title": "AnyOf"
    },
    "AllOf": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["values"],
      "title": "AllOf"
    },
    "NoneOf": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["values"],
      "title": "NoneOf"
    },
    "Option": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "display_value": {
          "type": "string"
        },
        "value": {
          "type": ["string", "null"]
        }
      },
      "required": ["display_value"],
      "title": "Option"
    },
    "DefaultValue": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "number"
        },
        {
          "type": "null"
        },
        {
          "type": "string"
        }
      ],
      "title": "DefaultValue"
    }
  }
}
