{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Ruumiradar developer feed V1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "company_id",
    "generated_at",
    "projects"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "company_id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "projects": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "external_id",
          "name",
          "website",
          "source_updated_at"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "ruumiradar_id": {
            "type": "string",
            "pattern": "^P[1-9][0-9]*$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "website": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "source_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "stage": {
            "type": "string",
            "enum": [
              "planning",
              "adopted",
              "design",
              "building",
              "completed"
            ]
          },
          "homes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "address": {
            "type": "string",
            "maxLength": 300
          },
          "open_house": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "starts_at",
              "ends_at",
              "url"
            ],
            "properties": {
              "starts_at": {
                "type": "string",
                "format": "date-time"
              },
              "ends_at": {
                "type": "string",
                "format": "date-time"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            }
          }
        }
      }
    }
  }
}
