{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://intw.example/spec/intw-core-pre-1.0.schema.json",
  "title": "INTW Wrapper Level 0 schema",
  "description": "Candidate minimum structural profile for implementation testing. It does not establish full INTW Protocol conformance, legal compliance, federation capability or production readiness.",
  "type": "object",
  "required": ["id", "type", "about", "source", "provenance", "rights", "status"],
  "properties": {
    "id": {"type": "string", "minLength": 1},
    "type": {"type": "string", "minLength": 1},
    "about": {"type": "array", "minItems": 1, "items": {"type": ["string", "object"]}},
    "source": {"type": "object", "minProperties": 1},
    "content": {},
    "provenance": {"type": "object", "minProperties": 1},
    "rights": {"type": "object", "minProperties": 1},
    "status": {"type": "object", "minProperties": 1},
    "legal_basis": {"type": ["object", "null"]},
    "jurisdiction": {"type": "object"},
    "classification": {"type": "object"},
    "custodian": {"type": "object", "required": ["held_by"]},
    "responsibility": {"type": "object"},
    "confidence": {"type": "object"},
    "relationships": {"type": "array"},
    "participations": {
      "type": "array",
      "items": {"$ref": "#/$defs/participation"}
    }
  },
  "$defs": {
    "participation": {
      "type": "object",
      "description": "A situated and evidenced account of how an entity takes part in a context. Actorship is a role in this relation, not an intrinsic entity type.",
      "required": ["participant", "context", "role", "observed_effect", "evidence", "asserted_by", "validation"],
      "properties": {
        "participant": {"type": "string", "minLength": 1},
        "context": {"type": "string", "minLength": 1},
        "role": {"type": "string", "minLength": 1},
        "observed_effect": {},
        "evidence": {"type": "array", "minItems": 1},
        "asserted_by": {"type": "string", "minLength": 1},
        "confidence": {"type": "object"},
        "validation": {"type": "object"}
      }
    }
  },
  "allOf": [
    {
      "if": {"properties": {"type": {"const": "intertween"}}, "required": ["type"]},
      "then": {
        "properties": {
          "custody_status": {"enum": ["pending", "assigned"]},
          "responsibility": {
            "type": "object",
            "required": ["ownership"],
            "properties": {
              "ownership": {
                "type": "object",
                "required": ["state", "touching_mandates"],
                "properties": {
                  "state": {"enum": ["unclaimed", "surfaced", "between", "contested", "emerging", "claimed"]},
                  "touching_mandates": {"type": "array"}
                }
              }
            }
          }
        },
        "required": ["custody_status", "responsibility"]
      }
    }
  ]
}
