{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://example.com/root.json",
  "type": "object",
  "required": [
    "type",
    "features",
    "source_type",
    "source_id"
  ],
  "properties": {
    "type": {
      "examples": [
        "FeatureCollection"
      ]
    },
    "features": {
      "type": ["array", "null"],
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "examples": [
              "Feature"
            ]
          },
          "geometry": {
            "minLength": 1,
            "type": ["object", "null"],
            "examples": [
              "Point"
            ]
          },
          "properties": {
            "properties": {
              "name": {
                "type": "string",
                "examples": [
                  "CFGLOC108440"
                ]
              },
              "site": {
                "type": "string",
                "examples": [
                  "HARV"
                ]
              },
              "install_date": {
                "type": "string",
                "format": "date-time",
                "examples": [
                  "2017-02-07T00:17:20Z"
                ]
              },
              "remove_date": {
                "type": ["string", "null"],
                "format": "date-time",
                "examples": [
                  "2017-02-07T00:18:28Z"
                ]
              },
              "context": {
                "type": "array",
                "items": {
                  "minLength": 1,
                  "type": "string",
                  "examples": [
                    "soil"
                  ]
                }
              },
              "locations": {
                "type": "object",
                "minLength": 1,
                "required": [
                  "type",
                  "features"
                ],
                "properties": {
                  "type": {
                    "minLength": 1,
                    "type": "string",
                    "examples": [
                      "FeatureCollection"
                    ]
                  },
                  "features": {
                    "minLength": 1,
                    "type": "array",
                    "items": {
                      "minLength": 1,
                      "type": "object",
                      "required": [
                        "type",
                        "geometry",
                        "properties"
                      ],
                      "properties": {
                        "type": {
                          "minLength": 1,
                          "type": "string",
                          "examples": [
                            "Feature"
                          ]
                        },
                        "geometry": {
                          "minLength": 1,
                          "type": ["object", "null"],
                          "examples": [
                            "Point"
                          ]
                        },
                        "properties": {
                          "minLength": 1,
                          "type": "object",
                          "required": [
                            "start_date",
                            "end_date",
                            "z_offset",
                            "reference_location"
                          ],
                          "properties": {
                            "start_date": {
                              "minLength": 1,
                              "type": "string",
                              "format": "date-time",
                              "examples": [
                                "2010-01-01T00:00:00Z"
                              ]
                            },
                            "end_date": {
                              "minLength": 1,
                              "type": ["string", "null"],
                              "format": "date-time",
                              "examples": [
                                "2010-01-01T00:00:00Z"
                              ]
                            },
                            "z_offset": {
                              "minLength": 1,
                              "type": "number",
                              "examples": [
                                -0.02
                              ]
                            },
                            "reference_location": {
                              "minLength": 1,
                              "type": ["object","null"],
                              "properties": {
                                "type": {
                                  "minLength": 1,
                                  "type": "string",
                                  "examples": [
                                    "Feature"
                                  ]
                                },
                                "geometry": {
                                  "minLength": 1,
                                  "type": ["object", "null"],
                                  "examples": [
                                    "Point"
                                  ]
                                },
                                "properties": {
                                  "minLength": 1,
                                  "type": "object",
                                  "required": [
                                    "name",
                                    "locations"
                                  ],
                                  "properties": {
                                    "name": {
                                      "minLength": 1,
                                      "type": "string",
                                      "examples": [
                                        "SOILPL100441"
                                      ]
                                    },
                                    "locations": {
                                      "minLength": 1,
                                      "type": ["object", "null"],
                                      "required": [
                                        "type",
                                        "features"
                                      ],
                                      "properties": {
                                        "type": {
                                          "minLength": 1,
                                          "type": "string",
                                          "examples": [
                                            "FeatureCollection"
                                          ]
                                        },
                                        "features": {
                                          "minLength": 1,
                                          "type": "array",
                                          "items": {
                                            "minLength": 1,
                                            "type": "object",
                                            "required": [
                                              "type",
                                              "geometry",
                                              "properties"
                                            ],
                                            "properties": {
                                              "type": {
                                                "minLength": 1,
                                                "type": "string",
                                                "examples": [
                                                  "Feature"
                                                ]
                                              },
                                              "geometry": {
                                                "minLength": 1,
                                                "type": ["object", "null"],
                                                "examples": [
                                                  "Point"
                                                ]
                                              },
                                              "properties": {
                                                "minLength": 1,
                                                "type": "object",
                                                "required": [
                                                  "start_date",
                                                  "end_date",
                                                  "z_offset",
                                                  "reference_location"
                                                ],
                                                "properties": {
                                                  "start_date": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "examples": [
                                                      "2010-01-01T00:00:00Z"
                                                    ]
                                                  },
                                                  "end_date": {
                                                    "type": ["string", "null"],
                                                    "format": "date-time",
                                                    "examples": [
                                                      "2010-01-01T00:00:00Z"
                                                    ]
                                                  },
                                                  "z_offset": {
                                                    "minLength": 1,
                                                    "type": "number",
                                                    "examples": [
                                                      0.00
                                                    ]
                                                  },
                                                  "reference_location": {
                                                    "minLength": 1,
                                                    "type": ["object","null"],
                                                    "properties": {
                                                      "type": {
                                                        "minLength": 1,
                                                        "type": "string",
                                                        "examples": [
                                                          "Feature"
                                                        ]
                                                      },
                                                      "geometry": {
                                                        "minLength": 1,
                                                        "type": ["string", "null"],
                                                        "examples": [
                                                          "Point"
                                                        ]
                                                      },
                                                      "properties": {
                                                        "minLength": 1,
                                                        "type": "object",
                                                        "required": [
                                                          "name",
                                                          "locations"
                                                        ],
                                                        "properties": {
                                                          "name": {
                                                            "minLength": 1,
                                                            "type": "string",
                                                            "examples": [
                                                              "SOILPL100441"
                                                            ]
                                                          },
                                                          "locations": {
                                                            "minLength": 1,
                                                            "examples": [
                                                              null
                                                            ]
                                                          }
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "Required Asset Management Location ID": {
            "minLength": 1,
            "type": "integer",
            "examples": [
              9915
            ]
          },
          "Required Asset Management Location Code": {
            "minLength": 1,
            "type": "string",
            "examples": [
              "CFGLOC108440"
            ]
          }
        }
      }
    },
    "source_type": {
      "type": "string",
      "examples": [
        "prt"
      ]
    },
    "source_id": {
      "type": "integer",
      "examples": [
        19963
      ]
    }
  }
}
