{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://harmony.earthdata.nasa.gov/schemas/collection-capabilities/v3/collection-capabilities-v3.json",
  "title": "Harmony Collection Capabilities (version 3)",
  "description": "Describes the Harmony transformation capabilities available for a given CMR collection, in version 3 of the collection capabilities JSON format.",
  "type": "object",
  "properties": {
    "conceptId": {
      "description": "The CMR concept ID of the collection.",
      "type": "string"
    },
    "shortName": {
      "description": "The CMR short name of the collection.",
      "type": "string"
    },
    "summary": {
      "description": "A summary of the Harmony capabilities available for the collection across all applicable services. Some capabilities cannot be used together; see the `services` field to determine the capabilities supported by individual services and valid capability combinations.",
      "$ref": "#/$defs/serviceCapabilities"
    },
    "services": {
      "description": "The Harmony services applicable to the collection.",
      "type": "array",
      "items": { "$ref": "#/$defs/service" }
    },
    "variables": {
      "description": "The variables associated with the collection.",
      "type": "array",
      "items": { "$ref": "#/$defs/variable" }
    },
    "capabilitiesVersion": {
      "description": "The version identifier for the capabilities response format.",
      "type": "string",
      "const": "3"
    }
  },
  "required": [ "conceptId", "shortName", "summary", "services", "variables", "capabilitiesVersion" ],
  "additionalProperties": false,
  "$defs": {
    "service": {
      "type": "object",
      "properties": {
        "name": {
          "description": "The name of the Harmony service.",
          "type": "string"
        },
        "href": {
          "description": "A URL reference to the UMM-S record for the service in the CMR, present only when the service is associated with one.",
          "type": "string"
        },
        "capabilities": { "$ref": "#/$defs/serviceCapabilities" }
      },
      "required": [ "name", "capabilities" ],
      "additionalProperties": false
    },
    "serviceCapabilities": {
      "type": "object",
      "properties": {
        "subsetting": {
          "type": "object",
          "properties": {
            "bbox": { "type": "boolean" },
            "dimension": { "type": "boolean" },
            "shape": { "type": "boolean" },
            "temporal": { "type": "boolean" },
            "variable": { "type": "boolean" }
          },
          "required": [ "bbox", "dimension", "shape", "temporal", "variable" ],
          "additionalProperties": false
        },
        "reprojection": {
          "type": "object",
          "properties": {
            "supported": { "type": "boolean" },
            "supportedProjections": {
              "type": "array",
              "items": { "$ref": "#/$defs/projection" }
            },
            "interpolationMethods": {
              "type": "array",
              "items": { "type": "string" }
            }
          },
          "required": [ "supported", "supportedProjections", "interpolationMethods" ],
          "additionalProperties": false
        },
        "averaging": {
          "type": "object",
          "properties": {
            "time": { "type": "boolean" },
            "area": { "type": "boolean" }
          },
          "required": [ "time", "area" ],
          "additionalProperties": false
        },
        "concatenation": { "type": "boolean" },
        "outputFormats": {
          "type": "array",
          "items": { "$ref": "#/$defs/outputFormat" }
        }
      },
      "required": [ "subsetting", "reprojection", "averaging", "concatenation", "outputFormats" ],
      "additionalProperties": false
    },
    "projection": {
      "type": "object",
      "properties": {
        "name": {
          "description": "The name of the supported output projection.",
          "type": "string"
        },
        "crs": {
          "description": "The coordinate reference system identifier (e.g. an EPSG code) that can be passed as the outputCRS parameter.",
          "type": "string"
        }
      },
      "required": [ "crs" ],
      "additionalProperties": false
    },
    "outputFormat": {
      "type": "object",
      "properties": {
        "name": {
          "description": "The display name of the output format.",
          "type": "string"
        },
        "mimeType": {
          "description": "The MIME type of the output format.",
          "type": "string"
        }
      },
      "required": [ "name", "mimeType" ],
      "additionalProperties": false
    },
    "variable": {
      "type": "object",
      "properties": {
        "name": {
          "description": "The name of the variable.",
          "type": "string"
        },
        "longName": {
          "description": "The long name of the variable.",
          "type": "string"
        },
        "href": {
          "description": "A URL reference to the UMM-Var record for the variable in the CMR.",
          "type": "string"
        },
        "units": {
          "description": "The units of the variable, present only when the CMR UMM-Var record specifies them.",
          "type": "string"
        },
        "scienceKeywords": {
          "description": "The science keywords associated with the variable.",
          "type": "array",
          "items": { "$ref": "#/$defs/scienceKeyword" }
        }
      },
      "required": [ "name", "longName", "href", "scienceKeywords" ],
      "additionalProperties": false
    },
    "scienceKeyword": {
      "type": "object",
      "properties": {
        "category": { "type": "string" },
        "topic": { "type": "string" },
        "term": { "type": "string" },
        "variableLevel1": { "type": "string" },
        "variableLevel2": { "type": "string" },
        "variableLevel3": { "type": "string" },
        "detailedVariable": { "type": "string" }
      },
      "required": [ "category", "topic", "term" ],
      "additionalProperties": false
    }
  }
}
