{
  "$id": "https://www.hestia.earth/schema-data/json-schema/Organisation.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$comment": "Schema version 39.0.1",
  "title": "Organisation",
  "description": "The organisation which manages the [Site(s)](/schema/Site).",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "description": "My local unique ID",
      "examples": [
        "my-unique-id-1"
      ],
      "exportDefaultCSV": true,
      "pattern": "^[\\w\\u00C0-\\u017F\\-\\.\\s\\(\\),+]+$"
    },
    "@id": {
      "type": "string",
      "description": "Unique id assigned by HESTIA",
      "examples": [
        "@hestia-unique-id-1"
      ],
      "extend": true,
      "exportDefaultCSV": true
    },
    "type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Organisation",
      "enum": [
        "Organisation"
      ]
    },
    "@type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Organisation",
      "enum": [
        "Organisation"
      ],
      "extend": true
    },
    "name": {
      "type": "string",
      "description": "The name of the Organisation.",
      "examples": [
        "La Ferme du Grand Roc"
      ],
      "extend": true,
      "searchable": true,
      "exportDefaultCSV": true,
      "recommended": true
    },
    "description": {
      "type": "string",
      "description": "A description of the Organisation.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "boundary": {
      "type": "object",
      "description": "A nested GeoJSON object for the Organisation boundary of type 'FeatureCollection', 'Feature' or 'GeometryCollection' in the WGS84 datum.",
      "examples": [],
      "geojson": true
    },
    "boundaryArea": {
      "type": "number",
      "minimum": 0,
      "description": "The area in km2 of the boundary. This field is automatically calculated when boundary is provided.",
      "examples": [],
      "internal": true
    },
    "area": {
      "type": "number",
      "description": "The area of the Organisation in hectares.",
      "examples": [],
      "exclusiveMinimum": 0
    },
    "latitude": {
      "type": "number",
      "minimum": -90,
      "maximum": 90,
      "description": "The latitude of the Organisation (-90 to 90).",
      "examples": [
        49.16472
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "longitude": {
      "type": "number",
      "minimum": -180,
      "maximum": 180,
      "description": "The longitude of the Organisation (-180 to 180).",
      "examples": [
        6.901544
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "streetAddress": {
      "type": "string",
      "description": "The street address.",
      "examples": []
    },
    "city": {
      "type": "string",
      "description": "The city or town.",
      "examples": [
        "Œting"
      ]
    },
    "region": {
      "$ref": "./Term-deep.json#",
      "description": "The most specific geographical region from the Glossary.",
      "examples": [
        {
          "@id": "GADM-FRA.6.9_1",
          "@type": "Term",
          "name": "Moselle",
          "termType": "region"
        }
      ],
      "searchable": true
    },
    "country": {
      "$ref": "./Term-deep.json#",
      "description": "The country from the Glossary.",
      "examples": [
        {
          "@id": "GADM-FRA",
          "@type": "Term",
          "name": "France",
          "termType": "region"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "postOfficeBoxNumber": {
      "type": "string",
      "description": "The post office box number.",
      "examples": []
    },
    "postalCode": {
      "type": "string",
      "description": "The postal code.",
      "examples": []
    },
    "website": {
      "type": "object",
      "required": [
        "@id"
      ],
      "properties": {
        "@id": {
          "type": "string"
        }
      },
      "description": "A link to a website describing the Organisation.",
      "examples": []
    },
    "glnNumber": {
      "type": "string",
      "pattern": "^\\d{13}$",
      "description": "The Global Location Number.",
      "examples": []
    },
    "startDate": {
      "type": "string",
      "description": "The start date of the Organisation in ISO 8601 format (YYYY-MM-DD, YYYY-MM, or YYYY).",
      "examples": [
        "1989-06-01"
      ],
      "datePattern": true
    },
    "endDate": {
      "type": "string",
      "description": "The end date of the Organisation in ISO 8601 format (YYYY-MM-DD, YYYY-MM, or YYYY).",
      "examples": [],
      "datePattern": true
    },
    "infrastructure": {
      "type": "array",
      "items": {
        "$ref": "./Infrastructure.json#"
      },
      "description": "The Infrastructure on the Site.",
      "examples": [],
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "term.@id"
      ]
    },
    "dataPrivate": {
      "type": "boolean",
      "description": "If these data are private. Private means that HESTIA administrators can access these data and you can grant access to other platform users, but these data will not be made available to any other users of the platform or distributed to third parties.",
      "examples": [],
      "default": false
    },
    "originalId": {
      "type": "string",
      "description": "The identifier for these data in the source database.",
      "examples": [],
      "internal": true
    },
    "uploadBy": {
      "$ref": "./Actor-deep.json#",
      "description": "The user who uploaded these data.",
      "examples": [
        {
          "@id": "actor-577",
          "@type": "Actor",
          "name": "J. Poore, University of Oxford"
        }
      ],
      "internal": true
    },
    "schemaVersion": {
      "type": "string",
      "description": "The version of the schema when these data were created.",
      "examples": [],
      "internal": true,
      "searchable": true
    },
    "createdAt": {
      "type": "string",
      "description": "Date created on HESTIA in ISO 8601 format (YYYY-MM-DD).",
      "examples": [],
      "format": "date",
      "internal": true,
      "searchable": true
    },
    "updatedAt": {
      "type": "string",
      "description": "Last update date on HESTIA in ISO 8601 format (YYYY-MM-DD).",
      "examples": [],
      "format": "date",
      "internal": true,
      "searchable": true
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "country"
        ]
      },
      "then": {
        "properties": {
          "country": {
            "properties": {
              "termType": {
                "enum": [
                  "region"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "region"
        ]
      },
      "then": {
        "properties": {
          "region": {
            "properties": {
              "termType": {
                "enum": [
                  "region"
                ]
              }
            }
          }
        }
      }
    }
  ],
  "oneOf": [
    {
      "required": [
        "@type",
        "@id"
      ]
    },
    {
      "required": [
        "type",
        "id"
      ]
    }
  ],
  "required": [
    "country",
    "dataPrivate",
    "uploadBy"
  ]
}