{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://daarion.city/schemas/clan-envelope.schema.json",
  "title": "CLAN Envelope",
  "type": "object",
  "required": [
    "request_id",
    "visibility_level_target",
    "consent_status",
    "allowed_actions",
    "expected_output",
    "input_text"
  ],
  "properties": {
    "request_id": {"type": "string", "minLength": 8},
    "circle_context": {"type": "object", "additionalProperties": true},
    "visibility_level_target": {
      "type": "string",
      "enum": ["public", "interclan", "incircle", "soulsafe", "sacred"]
    },
    "sensitivity_flags": {
      "type": "array",
      "items": {"type": "string"},
      "default": []
    },
    "consent_status": {
      "type": "string",
      "enum": ["none", "pending", "confirmed"]
    },
    "allowed_actions": {
      "type": "array",
      "items": {"type": "string"},
      "minItems": 1
    },
    "expected_output": {
      "oneOf": [
        {"type": "string"},
        {"type": "array", "items": {"type": "string"}, "minItems": 1}
      ]
    },
    "input_text": {"type": "string", "minLength": 1},
    "provenance": {"type": "object", "additionalProperties": true}
  },
  "additionalProperties": false
}
