{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ngff.openmicroscopy.org/0.5/schemas/image.schema",
  "title": "OME-Zarr Image",
  "description": "The zarr.json attributes key",
  "type": "object",
  "properties": {
    "ome": {
      "description": "The versioned OME-Zarr Metadata namespace",
      "type": "object",
      "properties": {
        "multiscales": {
          "$ref": "#/$defs/multiscales"
        },
        "omero": {
          "$ref": "#/$defs/omero"
        },
        "version": {
          "$ref": "https://ngff.openmicroscopy.org/0.5/schemas/_version.schema"
        }
      },
      "required": [
        "multiscales",
        "version"
      ]
    }
  },
  "required": [
    "ome"
  ],
  "$defs": {
    "multiscales": {
      "description": "The multiscale datasets for this image",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "datasets": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "coordinateTransformations": {
                  "$ref": "#/$defs/coordinateTransformations"
                }
              },
              "required": [
                "path",
                "coordinateTransformations"
              ]
            }
          },
          "axes": {
            "$ref": "#/$defs/axes"
          },
          "coordinateTransformations": {
            "$ref": "#/$defs/coordinateTransformations"
          }
        },
        "required": [
          "datasets",
          "axes"
        ]
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "omero": {
      "type": "object",
      "properties": {
        "channels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "window": {
                "type": "object",
                "properties": {
                  "end": {
                    "type": "number"
                  },
                  "max": {
                    "type": "number"
                  },
                  "min": {
                    "type": "number"
                  },
                  "start": {
                    "type": "number"
                  }
                },
                "required": [
                  "start",
                  "min",
                  "end",
                  "max"
                ]
              },
              "label": {
                "type": "string"
              },
              "family": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "active": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "required": [
        "channels"
      ]
    },
    "axes": {
      "type": "array",
      "uniqueItems": true,
      "minItems": 2,
      "maxItems": 5,
      "contains": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "space"
            ]
          },
          "unit": {
            "type": "string"
          }
        }
      },
      "minContains": 2,
      "maxContains": 3,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "channel",
                  "time",
                  "space"
                ]
              }
            },
            "required": [
              "name",
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "not": {
                  "enum": [
                    "space",
                    "time",
                    "channel"
                  ]
                }
              }
            },
            "required": [
              "name"
            ]
          }
        ]
      }
    },
    "coordinateTransformations": {
      "type": "array",
      "minItems": 1,
      "contains": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "scale"
            ]
          },
          "scale": {
            "type": "array",
            "minItems": 2,
            "items": {
              "type": "number"
            }
          }
        }
      },
      "maxContains": 1,
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "scale"
                ]
              },
              "scale": {
                "type": "array",
                "minItems": 2,
                "items": {
                  "type": "number"
                }
              }
            },
            "required": [
              "type",
              "scale"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "translation"
                ]
              },
              "translation": {
                "type": "array",
                "minItems": 2,
                "items": {
                  "type": "number"
                }
              }
            },
            "required": [
              "type",
              "translation"
            ]
          }
        ]
      }
    }
  }
}
