{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Condition Assessment",
  "description": "A qualitative conservation inspection (CRMsci E14 Condition Assessment) recording the condition state of a heritage object or place, encoded as a GeoJSON/JSON-FG Feature: CIDOC-CRM/CRMsci attributes nest under `properties` (GeoJSON convention), and a `choType` property carries the CRMsci class as a second alias to `@type`, alongside the fixed `type: \"Feature\"`. Localisation is optional: `geometry` may be `null` (no spatial localisation), an embedded GeoJSON geometry, or given by reference via topology (`topology`, see ogc.geo.topo.features.topo-feature) to avoid duplicating coordinates already recorded on the affected object.",
  "$defs": {
    "properties": {
      "type": "object",
      "required": [
        "choType",
        "affectedObject",
        "conditionState",
        "assessmentDate"
      ],
      "properties": {
        "choType": {
          "const": "ConditionAssessment",
          "description": "CRMsci class discriminator for this record (maps to sci:E14_Condition_Assessment via a second alias to @type, alongside the fixed GeoJSON `type: \"Feature\"`).",
          "x-jsonld-id": "@type"
        },
        "affectedObject": {
          "type": "string",
          "format": "uri",
          "description": "URI of the heritage-object, architectural-space or place being assessed.",
          "x-jsonld-id": "http://www.cidoc-crm.org/cidoc-crm/P140_assigned_attribute_to",
          "x-jsonld-type": "@id"
        },
        "conditionState": {
          "type": "object",
          "description": "The E3 Condition State found by this assessment: the type of condition, its severity and a textual description of its spatial extent.",
          "properties": {
            "conditionType": {
              "type": "string",
              "format": "uri",
              "description": "Getty AAT URI for the type of condition (e.g. crack, moisture, corrosion)."
            },
            "severity": {
              "type": "string",
              "enum": [
                "minor",
                "moderate",
                "severe",
                "critical"
              ],
              "description": "Qualitative severity level."
            },
            "extent": {
              "type": "string",
              "description": "Textual description of the area, length or volume affected."
            }
          },
          "required": [
            "conditionType",
            "severity"
          ],
          "x-jsonld-id": "http://www.cidoc-crm.org/cidoc-crm/P35_has_identified",
          "x-jsonld-type": "@json"
        },
        "assessmentDate": {
          "type": "string",
          "format": "date",
          "description": "Date on which the assessment was carried out (ISO 8601).",
          "x-jsonld-id": "http://www.cidoc-crm.org/cidoc-crm/P4_has_time-span",
          "x-jsonld-type": "http://www.w3.org/2001/XMLSchema#date"
        },
        "assessor": {
          "type": "string",
          "format": "uri",
          "description": "URI of the agent (person or organisation) who carried out the assessment.",
          "x-jsonld-id": "http://www.w3.org/ns/prov#wasAttributedTo",
          "x-jsonld-type": "@id"
        },
        "method": {
          "type": "string",
          "description": "Label or URI of the inspection technique used (e.g. \"visual inspection\", \"thermographic survey\", \"photogrammetric analysis\").",
          "x-jsonld-id": "http://www.cidoc-crm.org/cidoc-crm/P33_used_specific_technique"
        },
        "confidence": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high"
          ],
          "description": "Confidence level in the assessment result."
        },
        "evidence": {
          "type": "array",
          "description": "URIs of digital representations or archival documents used as evidence.",
          "items": {
            "type": "string",
            "format": "uri"
          },
          "x-jsonld-id": "http://www.cidoc-crm.org/cidoc-crm/P16_used_specific_object",
          "x-jsonld-type": "@id",
          "x-jsonld-container": "@set"
        },
        "recommendation": {
          "type": "string",
          "description": "Free-text conservation recommendation arising from this assessment.",
          "x-jsonld-id": "http://www.cidoc-crm.org/cidoc-crm/P3_has_note"
        },
        "reviewStatus": {
          "type": "string",
          "description": "Workflow status of this record (e.g. draft, reviewed, approved)."
        }
      }
    }
  },
  "allOf": [
    {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "https://opengeospatial.github.io/bblocks/annotated-schemas/geo/json-fg/feature-lenient/schema.json"
            },
            {
              "type": "object",
              "description": "Condition assessment localised by its own embedded geometry, or not spatially localised at all (`geometry: null`).",
              "not": {
                "required": [
                  "topology"
                ]
              },
              "properties": {
                "geometry": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "object",
                      "required": [
                        "type",
                        "coordinates"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "Point",
                            "LineString",
                            "Polygon",
                            "MultiPoint",
                            "MultiLineString",
                            "MultiPolygon"
                          ]
                        }
                      }
                    }
                  ]
                }
              }
            }
          ]
        },
        {
          "$ref": "https://ogcincubator.github.io/topo-feature/build/annotated/geo/topo/features/topo-feature/schema.json"
        }
      ]
    },
    {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "Persistent URI identifying this condition assessment record (overrides the inherited `id`, which also allows a bare number)."
        },
        "properties": {
          "$ref": "#/$defs/properties"
        }
      }
    }
  ],
  "x-jsonld-extra-terms": {
    "ConditionAssessment": "http://www.ics.forth.gr/isl/CRMsci/E14_Condition_Assessment"
  },
  "x-jsonld-prefixes": {
    "sci": "http://www.ics.forth.gr/isl/CRMsci/",
    "crm": "http://www.cidoc-crm.org/cidoc-crm/",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "prov": "http://www.w3.org/ns/prov#"
  }
}