{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://iarpg.com/world-context-profile.schema.json",
  "title": "IARPG archival world-context profile",
  "type": "object",
  "required": [
    "$schema",
    "id",
    "release",
    "version",
    "status",
    "updated_utc",
    "truth_boundary",
    "profile"
  ],
  "properties": {
    "$schema": {
      "const": "https://iarpg.com/world-context-profile.schema.json"
    },
    "id": {
      "type": "string",
      "pattern": "^https://iarpg\\.com/world-context/entities/[a-z0-9-]+\\.json$"
    },
    "release": {
      "const": "IARPG-OPS-2"
    },
    "version": {
      "const": "2.0.21-wip"
    },
    "status": {
      "const": "work-in-progress-archival-context-profile"
    },
    "updated_utc": {
      "type": "string",
      "format": "date-time"
    },
    "truth_boundary": {
      "type": "string",
      "minLength": 120
    },
    "profile": {
      "type": "object",
      "required": [
        "entity_id",
        "name",
        "source_code",
        "source_entity_class",
        "source_region",
        "roadmap_country",
        "coverage_region",
        "roadmap_status",
        "profile_status",
        "source_row_count",
        "published_fact_count",
        "available_lenses",
        "summary",
        "facts",
        "profile_url"
      ],
      "properties": {
        "entity_id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "source_code": {
          "type": "string",
          "minLength": 1
        },
        "source_entity_class": {
          "type": "string",
          "minLength": 1
        },
        "source_region": {
          "type": [
            "string",
            "null"
          ]
        },
        "roadmap_country": {
          "type": [
            "string",
            "null"
          ]
        },
        "coverage_region": {
          "type": [
            "string",
            "null"
          ]
        },
        "roadmap_status": {
          "enum": [
            "matched",
            "component",
            "additional"
          ]
        },
        "profile_status": {
          "const": "archival-context-not-current-assessment"
        },
        "source_row_count": {
          "type": "integer",
          "minimum": 1
        },
        "published_fact_count": {
          "type": "integer",
          "minimum": 1
        },
        "available_lenses": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "summary": {
          "type": "object"
        },
        "facts": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "required": [
              "id",
              "label",
              "category",
              "lens",
              "content",
              "display",
              "source_field"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9_]+$"
              },
              "label": {
                "type": "string",
                "minLength": 1
              },
              "category": {
                "type": "string",
                "minLength": 1
              },
              "lens": {
                "enum": [
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "place",
                  "people",
                  "people",
                  "people",
                  "people",
                  "people",
                  "people",
                  "people",
                  "people",
                  "people",
                  "people",
                  "institutions",
                  "institutions",
                  "institutions",
                  "institutions",
                  "institutions",
                  "institutions",
                  "institutions",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "economy",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "infrastructure",
                  "environment",
                  "environment",
                  "environment",
                  "environment",
                  "environment"
                ]
              },
              "content": {
                "type": "string",
                "minLength": 1
              },
              "display": {
                "type": "string",
                "minLength": 1
              },
              "source_field": {
                "type": "string",
                "minLength": 1
              },
              "value": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "estimate_year": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1800,
                "maximum": 2100
              }
            },
            "additionalProperties": false
          }
        },
        "profile_url": {
          "type": "string",
          "pattern": "^/world-context/entities/[a-z0-9-]+\\.json$"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$defs": {
    "fact": {
      "type": "object",
      "required": [
        "id",
        "label",
        "category",
        "lens",
        "content",
        "display",
        "source_field"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9_]+$"
        },
        "label": {
          "type": "string",
          "minLength": 1
        },
        "category": {
          "type": "string",
          "minLength": 1
        },
        "lens": {
          "enum": [
            "place",
            "place",
            "place",
            "place",
            "place",
            "place",
            "place",
            "place",
            "place",
            "place",
            "place",
            "people",
            "people",
            "people",
            "people",
            "people",
            "people",
            "people",
            "people",
            "people",
            "people",
            "institutions",
            "institutions",
            "institutions",
            "institutions",
            "institutions",
            "institutions",
            "institutions",
            "economy",
            "economy",
            "economy",
            "economy",
            "economy",
            "economy",
            "economy",
            "economy",
            "economy",
            "economy",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "infrastructure",
            "environment",
            "environment",
            "environment",
            "environment",
            "environment"
          ]
        },
        "content": {
          "type": "string",
          "minLength": 1
        },
        "display": {
          "type": "string",
          "minLength": 1
        },
        "source_field": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": [
            "number",
            "null"
          ]
        },
        "estimate_year": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1800,
          "maximum": 2100
        }
      },
      "additionalProperties": false
    }
  }
}
