{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://stac-extensions.github.io/instruments/v0.1.0/schema.json#",
  "title": "Instruments Extension",
  "description": "STAC Instruments Extension for STAC Collections and STAC Items.",
  "type": "object",
  "required": [
    "stac_extensions",
    "type"
  ],
  "properties": {
    "stac_extensions": {
      "type": "array",
      "contains": {
        "const": "https://stac-extensions.github.io/instruments/v0.1.0/schema.json"
      }
    },
    "type": {
      "$comment": "List the allowed STAC object types here, any of: Catalog, Collection, Feature (for Items)",
      "type": "string",
      "enum": [
        "Collection",
        "Feature"
      ]
    },
    "assets": {
      "$comment": "This validates the fields in Item Assets, but does not require them.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/fields"
      }
    },
    "assetTemplates": {
      "$comment": "This validates the fields in asset templates, remove this if not applicable.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/fields"
      }
    }
  },
  "oneOf": [
    {
      "$comment": "This validates the fields in the item properties, remove this if not applicable.",
      "type": "object",
      "required": ["type", "properties"],
      "properties": {
        "type": {
          "const": "Feature"
        },
        "properties": {
          "$ref": "#/definitions/fields"
        }
      }
    },
    {
      "$comment": "This is the schema for top-level fields and item assets in STAC Collections, remove this fully or in parts if not applicable.",
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "const": "Collection"
        },
        "summaries": {
          "$ref": "#/definitions/summaries"
        },
        "item_assets": {
          "$comment": "This validates the fields in item assets, remove this if not applicable.",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/fields"
          }
        }
      },
      "allOf": [
        {
          "$ref": "#/definitions/fields"
        }
      ]
    }
  ],
  "definitions": {
    "instrument_modes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": ["string","null"],
        "minLength": 1
      },
      "contains": {
        "$comment": "Ensure it's not all null values.",
        "type": "string"
      }
    },
    "fields": {
      "$comment": "Add your new fields here. Don't require them here as they would be required in all places where we reference the fields as possibly allowed.",
      "type": "object",
      "properties": {
        "instrument_modes": {
          "$ref": "#/definitions/instrument_modes"
        }
      }
    },
    "summaries": {
      "$comment": "These are examples summaries that allows lists, ranges and JSON schemas, depending on how it makes sense for the individual data types of the fields. Validation only works for lists and ranges. JSON Schema (type: object) can always be provided for fields, but the corresponding schema for lists (type: array and items) and ranges (properties) should only be provided if it actually makes sense.",
      "type": "object",
      "properties": {
        "instrument_modes": {
          "oneOf": [
            {
              "$ref": "#/definitions/instrument_modes"
            },
            {
              "type": "object"
            }
          ]
        }
      }
    }
  }
}
