{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://welldot.org/schema/v2/well.schema.json",
  "title": "well",
  "description": "The .well open format — a JSON standard for water well data. Depths in meters, diameters in millimeters, measured from ground level.",
  "type": "object",
  "properties": {
    "version": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0
        },
        {
          "type": "string",
          "pattern": "^\\d+\\.\\d+$"
        }
      ]
    },
    "@context": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {}
        },
        {
          "type": "object",
          "additionalProperties": {}
        }
      ]
    },
    "well_id": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "authority": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "primary": {
            "type": "boolean"
          }
        },
        "required": [
          "authority",
          "id"
        ],
        "additionalProperties": false
      }
    },
    "location": {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number"
        },
        "lng": {
          "type": "number"
        },
        "elevation": {
          "type": "number"
        },
        "properties": {
          "type": "object",
          "properties": {
            "elevation_datum": {
              "type": "string"
            },
            "crs": {
              "type": "string"
            },
            "lat_precision": {
              "type": "number"
            },
            "lng_precision": {
              "type": "number"
            },
            "elevation_precision": {
              "type": "number"
            },
            "original_crs": {
              "type": "string"
            },
            "timezone": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "lat",
        "lng"
      ],
      "additionalProperties": false
    },
    "profiles": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      }
    },
    "well_type": {
      "type": "string"
    },
    "well_purpose": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "name": {
      "type": "string"
    },
    "well_driller": {
      "type": "string"
    },
    "construction_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "obs": {
      "type": "string"
    },
    "lat": {
      "type": "number"
    },
    "lng": {
      "type": "number"
    },
    "elevation": {
      "type": "number"
    },
    "well_depth": {
      "type": "number"
    },
    "bore_hole": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "diameter": {
            "type": "number"
          },
          "drilling_method": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "diameter"
        ],
        "additionalProperties": false
      }
    },
    "well_case": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "diameter": {
            "type": "number"
          }
        },
        "required": [
          "from",
          "to",
          "type",
          "diameter"
        ],
        "additionalProperties": false
      }
    },
    "reduction": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "diam_from": {
            "type": "number"
          },
          "diam_to": {
            "type": "number"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "diam_from",
          "diam_to",
          "type"
        ],
        "additionalProperties": false
      }
    },
    "well_screen": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "diameter": {
            "type": "number"
          },
          "screen_slot": {
            "type": "number"
          },
          "slot_type": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "type",
          "diameter",
          "screen_slot"
        ],
        "additionalProperties": false
      }
    },
    "surface_case": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "diameter": {
            "type": "number"
          }
        },
        "required": [
          "from",
          "to",
          "diameter"
        ],
        "additionalProperties": false
      }
    },
    "hole_fill": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": [
              "gravel_pack",
              "seal"
            ]
          },
          "diameter": {
            "type": "number"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "type",
          "diameter",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "centralizers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "spacing": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "type": {
            "type": "string"
          },
          "diameter": {
            "type": "number"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "type"
        ],
        "additionalProperties": false
      }
    },
    "cement_pad": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "width": {
          "type": "number"
        },
        "thickness": {
          "type": "number"
        },
        "length": {
          "type": "number"
        }
      },
      "required": [
        "type",
        "width",
        "thickness",
        "length"
      ],
      "additionalProperties": false
    },
    "lithology": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "description": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "texture": {
            "type": "object",
            "properties": {
              "code": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "vocabulary": {
                "type": "string"
              }
            },
            "required": [
              "code"
            ],
            "additionalProperties": false
          },
          "geologic_unit": {
            "type": "string"
          },
          "aquifer_unit": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "description",
          "color",
          "texture",
          "geologic_unit",
          "aquifer_unit"
        ],
        "additionalProperties": false
      }
    },
    "fractures": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "depth": {
            "type": "number"
          },
          "water_intake": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "swarm": {
            "type": "boolean"
          },
          "azimuth": {
            "type": "number"
          },
          "dip": {
            "type": "number"
          },
          "depth_precision": {
            "type": "number"
          }
        },
        "required": [
          "depth",
          "water_intake",
          "description",
          "swarm",
          "azimuth",
          "dip"
        ],
        "additionalProperties": false
      }
    },
    "caves": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "number"
          },
          "to": {
            "type": "number"
          },
          "water_intake": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "water_intake",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "hydrodynamic_events": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "const": "spot_measurement"
                  },
                  "datetime": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                  },
                  "sequence": {
                    "type": "integer"
                  },
                  "operator": {
                    "type": "string"
                  },
                  "equipment": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "corrects": {
                    "type": "string"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "uri": {
                          "type": "string",
                          "format": "uri"
                        },
                        "media_type": {
                          "type": "string"
                        },
                        "document_type": {
                          "type": "string"
                        },
                        "filename": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "sha256": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "uri",
                        "media_type"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "static_level": {
                    "type": "number"
                  },
                  "static_level_precision": {
                    "type": "number"
                  },
                  "measurement_method": {
                    "type": "string"
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "rate": {
                          "type": "number"
                        },
                        "rate_precision": {
                          "type": "number"
                        },
                        "duration": {
                          "type": "number"
                        },
                        "readings": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "elapsed": {
                                "type": "number"
                              },
                              "datetime": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                              },
                              "depth": {
                                "type": "number"
                              },
                              "depth_precision": {
                                "type": "number"
                              },
                              "pressure": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "elapsed",
                              "depth"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "rate"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "recovery": {
                    "type": "object",
                    "properties": {
                      "readings": {
                        "type": "array",
                        "items": {
                          "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/steps/items/properties/readings/items"
                        }
                      }
                    },
                    "required": [
                      "readings"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime",
                  "static_level"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/id"
                  },
                  "type": {
                    "type": "string",
                    "const": "constant_rate"
                  },
                  "datetime": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/datetime"
                  },
                  "sequence": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/sequence"
                  },
                  "operator": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/operator"
                  },
                  "equipment": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/equipment"
                  },
                  "notes": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/notes"
                  },
                  "corrects": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/corrects"
                  },
                  "attachments": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments"
                  },
                  "static_level": {
                    "type": "number"
                  },
                  "static_level_precision": {
                    "type": "number"
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/steps/items"
                    }
                  },
                  "recovery": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/recovery"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/id"
                  },
                  "type": {
                    "type": "string",
                    "const": "step_drawdown"
                  },
                  "datetime": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/datetime"
                  },
                  "sequence": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/sequence"
                  },
                  "operator": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/operator"
                  },
                  "equipment": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/equipment"
                  },
                  "notes": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/notes"
                  },
                  "corrects": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/corrects"
                  },
                  "attachments": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments"
                  },
                  "static_level": {
                    "type": "number"
                  },
                  "static_level_precision": {
                    "type": "number"
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/steps/items"
                    }
                  },
                  "recovery": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/recovery"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime",
                  "steps"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/id"
                  },
                  "type": {
                    "type": "string",
                    "const": "airlift"
                  },
                  "datetime": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/datetime"
                  },
                  "sequence": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/sequence"
                  },
                  "operator": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/operator"
                  },
                  "equipment": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/equipment"
                  },
                  "notes": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/notes"
                  },
                  "corrects": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/corrects"
                  },
                  "attachments": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments"
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/steps/items"
                    }
                  },
                  "recovery": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/recovery"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime",
                  "steps"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/id"
                  },
                  "type": {
                    "type": "string",
                    "const": "recovery_only"
                  },
                  "datetime": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/datetime"
                  },
                  "sequence": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/sequence"
                  },
                  "operator": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/operator"
                  },
                  "equipment": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/equipment"
                  },
                  "notes": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/notes"
                  },
                  "corrects": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/corrects"
                  },
                  "attachments": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments"
                  },
                  "pumping_rate": {
                    "type": "number"
                  },
                  "pumping_duration": {
                    "type": "number"
                  },
                  "recovery": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/recovery"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime",
                  "recovery"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/id"
                  },
                  "type": {
                    "type": "string",
                    "const": "logger_series"
                  },
                  "datetime": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/datetime"
                  },
                  "sequence": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/sequence"
                  },
                  "operator": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/operator"
                  },
                  "equipment": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/equipment"
                  },
                  "notes": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/notes"
                  },
                  "corrects": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/corrects"
                  },
                  "attachments": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments"
                  },
                  "measurement_method": {
                    "type": "string"
                  },
                  "sensor_depth": {
                    "type": "number"
                  },
                  "interval": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "barometric_compensation": {
                    "type": "string",
                    "enum": [
                      "barologger",
                      "vented",
                      "none"
                    ]
                  },
                  "aggregation": {
                    "type": "string",
                    "enum": [
                      "none",
                      "hourly",
                      "daily"
                    ]
                  },
                  "readings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "datetime": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        "elapsed": {
                          "not": {}
                        },
                        "depth": {
                          "type": "number"
                        },
                        "depth_precision": {
                          "type": "number"
                        },
                        "pressure": {
                          "type": "number"
                        },
                        "depth_min": {
                          "type": "number"
                        },
                        "depth_max": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "datetime",
                        "depth"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1
                  },
                  "steps": {
                    "not": {}
                  },
                  "recovery": {
                    "not": {}
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime",
                  "readings"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/id"
              },
              "type": {
                "type": "string"
              },
              "datetime": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/datetime"
              },
              "sequence": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/sequence"
              },
              "operator": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/operator"
              },
              "equipment": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/equipment"
              },
              "notes": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/notes"
              },
              "corrects": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/corrects"
              },
              "attachments": {
                "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments"
              }
            },
            "required": [
              "id",
              "type",
              "datetime"
            ],
            "additionalProperties": true
          }
        ]
      }
    },
    "aquifer_analysis": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "datetime": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "analyst": {
            "type": "string"
          },
          "source_event_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "method": {
            "type": "string"
          },
          "static_level": {
            "type": "number"
          },
          "static_level_precision": {
            "type": "number"
          },
          "static_level_source_id": {
            "type": "string"
          },
          "dynamic_level": {
            "type": "number"
          },
          "dynamic_level_precision": {
            "type": "number"
          },
          "flow_rate": {
            "type": "number"
          },
          "flow_rate_precision": {
            "type": "number"
          },
          "max_flow_rate": {
            "type": "number"
          },
          "max_flow_rate_precision": {
            "type": "number"
          },
          "max_flow_rate_basis": {
            "type": "string"
          },
          "specific_capacity": {
            "type": "number"
          },
          "transmissivity": {
            "type": "number"
          },
          "storativity": {
            "type": "number"
          },
          "hydraulic_conductivity": {
            "type": "number"
          },
          "aquifer_thickness": {
            "type": "number"
          },
          "jacob_b": {
            "type": "number"
          },
          "jacob_c": {
            "type": "number"
          },
          "well_efficiency_pct": {
            "type": "number"
          },
          "notes": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
            }
          }
        },
        "required": [
          "id",
          "datetime",
          "source_event_ids"
        ],
        "additionalProperties": false
      }
    },
    "history_logs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "datetime": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "updated_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "category": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "author": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
            }
          },
          "hydrodynamic_event_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sample_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "maintenance_type": {
            "type": "string"
          },
          "pump_installation_id": {
            "type": "string"
          },
          "meter_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "maintenance",
              "inactive",
              "decommissioned",
              "abandoned"
            ]
          }
        },
        "required": [
          "id",
          "datetime",
          "category",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "attachments": {
      "type": "array",
      "items": {
        "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
      }
    },
    "pump_installations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "installed_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "removed_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "installed_by": {
            "type": "string"
          },
          "removed_by": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "power_source": {
            "type": "string"
          },
          "manufacturer": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "serial": {
            "type": "string"
          },
          "intake_depth": {
            "type": "number",
            "minimum": 0
          },
          "rated_flow_rate": {
            "type": "number",
            "minimum": 0
          },
          "rated_head": {
            "type": "number",
            "minimum": 0
          },
          "rated_power": {
            "type": "number",
            "minimum": 0
          },
          "stages": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "riser_diameter": {
            "type": "number",
            "minimum": 0
          },
          "riser_material": {
            "type": "string"
          },
          "check_valve": {
            "type": "boolean"
          },
          "electrical": {
            "type": "object",
            "properties": {
              "voltage": {
                "type": "number",
                "minimum": 0
              },
              "phases": {
                "type": "number",
                "enum": [
                  1,
                  3
                ]
              },
              "cable_section": {
                "type": "number",
                "minimum": 0
              },
              "cable_length": {
                "type": "number",
                "minimum": 0
              }
            },
            "additionalProperties": false
          },
          "notes": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
            }
          }
        },
        "required": [
          "id",
          "installed_at",
          "type"
        ],
        "additionalProperties": false
      }
    },
    "permits": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "authority": {
            "type": "string"
          },
          "identifier": {
            "type": "string"
          },
          "request_identifier": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "requested",
              "granted",
              "suspended",
              "revoked",
              "denied",
              "withdrawn"
            ]
          },
          "issued_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "valid_from": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "valid_until": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "renewal_requested_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "water_use": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "flow_rate": {
            "type": "number",
            "minimum": 0
          },
          "daily_operating_time": {
            "type": "number",
            "minimum": 0
          },
          "volume_limits": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "period": {
                  "type": "string",
                  "enum": [
                    "daily",
                    "monthly",
                    "annual"
                  ]
                },
                "volume": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "required": [
                "period",
                "volume"
              ],
              "additionalProperties": false
            }
          },
          "monthly_schedule": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "month": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                },
                "flow_rate": {
                  "type": "number",
                  "minimum": 0
                },
                "daily_operating_time": {
                  "type": "number",
                  "minimum": 0
                },
                "days": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 31
                }
              },
              "required": [
                "month"
              ],
              "additionalProperties": false
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "first_due": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "due_after": {
                  "type": "string",
                  "pattern": "^P(?=\\d)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?$"
                },
                "recurrence": {
                  "type": "string",
                  "pattern": "^P(?=\\d)(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?$"
                },
                "last_due": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "occurrences": {
                  "type": "integer",
                  "exclusiveMinimum": 0
                },
                "responsible": {
                  "type": "string"
                },
                "fulfillments": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "datetime": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                      },
                      "due_date": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "description": {
                        "type": "string"
                      },
                      "author": {
                        "type": "string"
                      },
                      "event_id": {
                        "type": "string"
                      },
                      "sample_id": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                      },
                      "attachments": {
                        "type": "array",
                        "items": {
                          "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
                        }
                      }
                    },
                    "required": [
                      "id",
                      "datetime"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "description"
              ],
              "additionalProperties": false
            }
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "type": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "done": {
                  "type": "boolean"
                },
                "due_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "updated_at": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                },
                "attachments": {
                  "type": "array",
                  "items": {
                    "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
                  }
                }
              },
              "required": [
                "id",
                "date",
                "description"
              ],
              "additionalProperties": false
            }
          },
          "supersedes": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
            }
          }
        },
        "required": [
          "id",
          "type",
          "authority"
        ],
        "additionalProperties": false
      }
    },
    "meters": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "installed_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "removed_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "installed_by": {
            "type": "string"
          },
          "removed_by": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "manufacturer": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "serial": {
            "type": "string"
          },
          "nominal_diameter": {
            "type": "number",
            "minimum": 0
          },
          "max_reading": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "notes": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
            }
          }
        },
        "required": [
          "id",
          "installed_at"
        ],
        "additionalProperties": false
      }
    },
    "production": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "const": "meter_reading"
                  },
                  "corrects": {
                    "type": "string"
                  },
                  "sequence": {
                    "type": "integer"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "datetime": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                  },
                  "meter_id": {
                    "type": "string"
                  },
                  "reading": {
                    "type": "number",
                    "minimum": 0
                  },
                  "source": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "datetime",
                  "meter_id",
                  "reading"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/id"
                  },
                  "type": {
                    "type": "string",
                    "const": "estimated_volume"
                  },
                  "corrects": {
                    "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/corrects"
                  },
                  "sequence": {
                    "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/sequence"
                  },
                  "notes": {
                    "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/notes"
                  },
                  "period_start": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                  },
                  "period_end": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                  },
                  "volume": {
                    "type": "number",
                    "minimum": 0
                  },
                  "method": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "period_start",
                  "period_end",
                  "volume"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/id"
              },
              "type": {
                "type": "string"
              },
              "corrects": {
                "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/corrects"
              },
              "sequence": {
                "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/sequence"
              },
              "notes": {
                "$ref": "#/properties/production/items/anyOf/0/anyOf/0/properties/notes"
              }
            },
            "required": [
              "id",
              "type"
            ],
            "additionalProperties": true
          }
        ]
      }
    },
    "operating_regime": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "effective_from": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "flow_rate": {
            "type": "number",
            "minimum": 0
          },
          "daily_operating_time": {
            "type": "number",
            "minimum": 0
          },
          "days_per_week": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          },
          "notes": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          }
        },
        "required": [
          "id",
          "effective_from"
        ],
        "additionalProperties": false
      }
    },
    "water_samples": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "datetime": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
          },
          "sample_type": {
            "type": "string"
          },
          "parent_sample_id": {
            "type": "string"
          },
          "sequence": {
            "type": "integer"
          },
          "campaign": {
            "type": "string"
          },
          "sampling_method": {
            "type": "string"
          },
          "sampling_point": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "depth": {
                "type": "number",
                "minimum": 0
              },
              "depth_precision": {
                "type": "number",
                "minimum": 0
              },
              "from": {
                "type": "number",
                "minimum": 0
              },
              "to": {
                "type": "number",
                "minimum": 0
              },
              "device": {
                "type": "string"
              },
              "pump_installation_id": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          "purge": {
            "type": "object",
            "properties": {
              "duration": {
                "type": "number",
                "minimum": 0
              },
              "volume": {
                "type": "number",
                "minimum": 0
              },
              "flow_rate": {
                "type": "number",
                "minimum": 0
              },
              "stabilized": {
                "type": "boolean"
              },
              "readings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "elapsed": {
                      "type": "number",
                      "minimum": 0
                    },
                    "parameter": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 1
                        },
                        "vocabulary": {
                          "type": "string",
                          "pattern": "^(welldot|cas|x-.+)$"
                        }
                      },
                      "required": [
                        "code",
                        "vocabulary"
                      ],
                      "additionalProperties": false
                    },
                    "value": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "elapsed",
                    "parameter",
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "static_level_event_id": {
            "type": "string"
          },
          "collected_by": {
            "type": "string"
          },
          "preservation": {
            "type": "string"
          },
          "chain_of_custody": {
            "type": "string"
          },
          "laboratory": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "accreditation": {
                "type": "string"
              },
              "report_number": {
                "type": "string"
              },
              "batch_id": {
                "type": "string"
              },
              "sample_id": {
                "type": "string"
              },
              "received_at": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
              },
              "received_at_resolution": {
                "type": "string",
                "const": "day"
              },
              "received_temperature": {
                "type": "number"
              }
            },
            "required": [
              "name"
            ],
            "additionalProperties": false
          },
          "corrects": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/properties/hydrodynamic_events/items/anyOf/0/anyOf/0/properties/attachments/items"
            }
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "parameter": {
                  "$ref": "#/properties/water_samples/items/properties/purge/properties/readings/items/properties/parameter"
                },
                "value": {
                  "type": "number"
                },
                "presence": {
                  "type": "boolean"
                },
                "text": {
                  "type": "string"
                },
                "qualifier": {
                  "type": "string",
                  "enum": [
                    "<",
                    ">",
                    "not_detected",
                    "estimated"
                  ]
                },
                "unit": {
                  "type": "string",
                  "minLength": 1
                },
                "detection_limit": {
                  "type": "number",
                  "minimum": 0
                },
                "quantification_limit": {
                  "type": "number",
                  "minimum": 0
                },
                "value_precision": {
                  "type": "number",
                  "minimum": 0
                },
                "fraction": {
                  "type": "string",
                  "enum": [
                    "total",
                    "dissolved",
                    "suspended"
                  ]
                },
                "filtration": {
                  "type": "object",
                  "properties": {
                    "pore_size": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "location": {
                      "type": "string",
                      "enum": [
                        "field",
                        "lab"
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "measured_in": {
                  "type": "string",
                  "enum": [
                    "field",
                    "lab"
                  ]
                },
                "method": {
                  "type": "string"
                },
                "analyzed_at": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                },
                "analyzed_at_resolution": {
                  "$ref": "#/properties/water_samples/items/properties/laboratory/properties/received_at_resolution"
                },
                "lab_flags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "validation": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "unvalidated",
                        "validated",
                        "qualified",
                        "rejected"
                      ]
                    },
                    "qualifier": {
                      "type": "string"
                    },
                    "guideline": {
                      "type": "string"
                    },
                    "validated_by": {
                      "type": "string"
                    },
                    "validated_at": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "additionalProperties": false
                },
                "notes": {
                  "type": "string"
                }
              },
              "required": [
                "parameter"
              ],
              "additionalProperties": false
            },
            "minItems": 1
          }
        },
        "required": [
          "id",
          "datetime",
          "sample_type",
          "results"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "version",
    "bore_hole",
    "well_case",
    "reduction",
    "well_screen",
    "surface_case",
    "hole_fill",
    "lithology",
    "fractures",
    "caves"
  ],
  "additionalProperties": true
}
