{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ngff.openmicroscopy.org/0.6.dev2/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": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/image.schema#/$defs/multiscales"
        },
        "omero": {
          "$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/image.schema#/$defs/omero"
        },
        "version": {
          "$ref": "https://ngff.openmicroscopy.org/0.6.dev2/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": {
                  "type": "array",
                  "uniqueItems": true,
                  "items": {
                    "$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/image.schema#/$defs/multiscale_coordinateTransformations"
                  },
                  "minItems": 1,
                  "maxItems": 1
                }
              },
              "required": [
                "path",
                "coordinateTransformations"
              ]
            }
          },
          "version": {
            "type": "string",
            "enum": [
              "0.6.dev2"
            ]
          },
          "coordinateSystems": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/coordinate_systems.schema#/$defs/coordinateSystem"
            }
          },
          "coordinateTransformations": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/coordinate_transformations.schema#/$defs/coordinateTransformation"
            }
          }
        },
        "required": [
          "datasets", "coordinateSystems"
        ]
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "multiscale_coordinateTransformations": {
      "description": "OME-NGFF coordinate transformation for multiscale resolution level datasets (only scale or scale & translate).",
      "oneOf": [
        {"$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/coordinate_transformations.schema#/$defs/scale"},
        {
          "type": "object",
          "properties": {
            "type": {"const": "sequence"},
            "transformations": {
              "type": "array",
              "items": {
                "oneOf": [
                  {"$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/coordinate_transformations.schema#/$defs/scale"},
                  {"$ref": "https://ngff.openmicroscopy.org/0.6.dev2/schemas/coordinate_transformations.schema#/$defs/translation"}
                ]
              },
              "minItems": 2,
              "maxItems": 2
            },
            "input": {"type": "string"},
            "output": {"type": "string"}
          },
          "required": ["type", "transformations", "input", "output"]
        }
      ]
    },
    "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"
      ]
    }
  }
}
