{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.stacspec.org/v1.1.0/collection-spec/json-schema/collection.json",
  "title": "STAC Collection Specification",
  "description": "This object represents Collections in a SpatioTemporal Asset Catalog.",
  "allOf": [
    {
      "$ref": "#/definitions/collection"
    },
    {
      "$ref": "../../item-spec/json-schema/common.json"
    }
  ],
  "definitions": {
    "collection": {
      "title": "STAC Collection",
      "description": "These are the fields specific to a STAC Collection.",
      "type": "object",
      "$comment": "title, description, keywords, providers and license is validated through the common metadata.",
      "required": [
        "stac_version",
        "type",
        "id",
        "description",
        "license",
        "extent",
        "links"
      ],
      "properties": {
        "stac_version": {
          "title": "STAC version",
          "type": "string",
          "const": "1.1.0"
        },
        "stac_extensions": {
          "title": "STAC extensions",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "title": "Reference to a JSON Schema",
            "type": "string",
            "format": "iri"
          }
        },
        "type": {
          "title": "Type of STAC entity",
          "const": "Collection"
        },
        "id": {
          "title": "Identifier",
          "type": "string",
          "minLength": 1
        },
        "extent": {
          "title": "Extents",
          "type": "object",
          "required": [
            "spatial",
            "temporal"
          ],
          "properties": {
            "spatial": {
              "title": "Spatial extent object",
              "type": "object",
              "required": [
                "bbox"
              ],
              "properties": {
                "bbox": {
                  "title": "Spatial extents",
                  "type": "array",
                  "oneOf": [
                    {
                      "minItems": 1,
                      "maxItems": 1
                    },
                    {
                      "minItems": 3
                    }
                  ],
                  "items": {
                    "title": "Spatial extent",
                    "type": "array",
                    "oneOf": [
                      {
                        "minItems": 4,
                        "maxItems": 4
                      },
                      {
                        "minItems": 6,
                        "maxItems": 6
                      }
                    ],
                    "items": {
                      "type": "number"
                    }
                  }
                }
              }
            },
            "temporal": {
              "title": "Temporal extent object",
              "type": "object",
              "required": [
                "interval"
              ],
              "properties": {
                "interval": {
                  "title": "Temporal extents",
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "title": "Temporal extent",
                    "type": "array",
                    "minItems": 2,
                    "maxItems": 2,
                    "items": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "pattern": "(\\+00:00|Z)$"
                    }
                  }
                }
              }
            }
          }
        },
        "assets": {
          "$ref": "../../item-spec/json-schema/item.json#/definitions/assets"
        },
        "item_assets": {
          "additionalProperties": {
            "allOf": [
              {
                "type": "object",
                "minProperties": 2,
                "properties": {
                  "href": {
                    "title": "Disallow href",
                    "not": {}
                  },
                  "title": {
                    "title": "Asset title",
                    "type": "string"
                  },
                  "description": {
                    "title": "Asset description",
                    "type": "string"
                  },
                  "type": {
                    "title": "Asset type",
                    "type": "string"
                  },
                  "roles": {
                    "title": "Asset roles",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              {
                "$ref": "../../item-spec/json-schema/common.json"
              }
            ]
          }
        },
        "links": {
          "$ref": "../../item-spec/json-schema/item.json#/definitions/links"
        },
        "summaries": {
          "$ref": "#/definitions/summaries"
        }
      }
    },
    "summaries": {
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "title": "JSON Schema",
            "type": "object",
            "minProperties": 1,
            "allOf": [
              {
                "$ref": "http://json-schema.org/draft-07/schema"
              }
            ]
          },
          {
            "title": "Range",
            "type": "object",
            "required": [
              "minimum",
              "maximum"
            ],
            "properties": {
              "minimum": {
                "title": "Minimum value",
                "type": [
                  "number",
                  "string"
                ]
              },
              "maximum": {
                "title": "Maximum value",
                "type": [
                  "number",
                  "string"
                ]
              }
            }
          },
          {
            "title": "Set of values",
            "type": "array",
            "minItems": 1,
            "items": {
              "description": "For each field only the original data type of the property can occur (except for arrays), but we can't validate that in JSON Schema yet. See the sumamry description in the STAC specification for details."
            }
          }
        ]
      }
    }
  }
}