{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ledigt.org/schema/1.0/index.schema.json",
  "title": "ledigt.org 1.0 index file",
  "description": "Published at https://<domain>/.well-known/ledigt.json or at the URL in the home page's <link rel=\"ledigt\">.",
  "type": "object",
  "required": ["ledigt", "publisher", "license"],
  "properties": {
    "$schema": { "type": "string" },
    "ledigt": { "type": "string", "pattern": "^1\\.[0-9]+$" },
    "publisher": {
      "type": "object",
      "required": ["name", "website"],
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 200 },
        "orgNumber": { "type": "string", "maxLength": 50 },
        "website": { "$ref": "listing.schema.json#/$defs/url" },
        "email": { "type": "string", "format": "email", "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$" },
        "phone": { "type": "string", "maxLength": 40 },
        "logo": { "$ref": "listing.schema.json#/$defs/url" }
      },
      "patternProperties": { "^x-": true },
      "additionalProperties": false
    },
    "license": { "type": "string", "pattern": "^[A-Za-z0-9.+-]+$", "description": "SPDX license identifier for the data in the index and feed files, e.g. CC-BY-4.0 or CC-BY-NC-ND-4.0. The publisher chooses it. It does not cover the files behind media URLs." },
    "registry": { "type": "boolean", "default": false, "description": "true = the publisher asks to be listed in a registry on ledigt.org, should one exist. false or omitted = the publisher must not be listed." },
    "feeds": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["category", "url"],
        "properties": {
          "category": { "enum": ["residential"], "description": "The only category in 1.0. commercial, storage and parking are reserved for future versions." },
          "url": { "$ref": "listing.schema.json#/$defs/url" },
          "count": { "type": "integer", "minimum": 0 },
          "updated": { "$ref": "listing.schema.json#/$defs/dateOrDateTime" }
        },
        "patternProperties": { "^x-": true },
        "additionalProperties": false
      }
    },
    "listings": {
      "type": "array",
      "maxItems": 5000,
      "items": { "$ref": "listing.schema.json" }
    }
  },
  "patternProperties": { "^x-": true },
  "additionalProperties": false,
  "oneOf": [
    { "required": ["feeds"] },
    { "required": ["listings"] }
  ]
}
