{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://fairicube.github.io/fairicube/v1.2.0/schema.json#",
  "title": "FAIRiCUBE Extension",
  "description": "STAC FAIRiCUBE Extension for STAC Items.",
  "type": "object",
  "required": [
    "stac_extensions",
    "type",
    "properties"
  ],
  "properties": {
    "stac_extensions": {
      "type": "array",
      "contains": {
        "const": "https://fairicube.github.io/fairicube/v1.2.0/schema.json"
      }
    }
  },
  "oneOf": [
    {
      "type": "object",
      "required": [
        "type",
        "properties"
      ],
      "properties": {
        "type": {
          "const": "Feature"
        },
        "properties": {
          "allOf": [
            {
              "$ref": "#/definitions/fields"
            },
            {
              "$ref": "#/definitions/containers"
            }
          ]
        },
        "assets": {
          "type": "object",
          "additionalProperties": {
            "allOf": [
              {
                "$ref": "#/definitions/fields"
              },
              {
                "$ref": "#/definitions/containers"
              }
            ]
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "Collection"
        }
      },
      "item_assets": {
        "type": "object",
        "additionalProperties": {
          "allOf": [
            {
              "$ref": "#/definitions/fields"
            },
            {
              "$ref": "#/definitions/containers"
            }
          ]
        }
      }
    }
  ],
  "definitions": {
    "containers": {
      "type": "object",
      "properties": {
        "bands": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/fields"
          }
        },
        "cube:dimensions": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/fields"
          }
        },
        "cube:variables": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/fields"
          }
        }
      }
    },
    "fields": {
      "type": "object",
      "properties": {
        "fairicube:purpose": {
          "type": "string",
          "minLength": 1
        },
        "fairicube:source_type": {
          "type": "string",
          "minLength": 1
        },
        "fairicube:quality_measures": {
          "type": "string",
          "minLength": 1
        },
        "fairicube:definition": {
          "type": "string",
          "minLength": 1
        },
        "fairicube:comment": {
          "type": "string",
          "minLength": 1
        },
        "fairicube:interpolation": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^(?!fairicube:)": {}
      },
      "additionalProperties": false
    }
  }
}