{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://eliyahoren.com/agents/protocol/PROPOSAL-SCHEMA.json",
  "title": "Project ETERNAL Constitutional Proposal Schema",
  "description": "Defines the canonical machine-readable data contract for all proposed constitutional amendments under Project ETERNAL.",
  "type": "object",
  "required": [
    "schema_version",
    "proposal_id",
    "title",
    "version",
    "status",
    "author",
    "target_baseline",
    "clauses",
    "rationale",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "enum": ["1.0.0"]
    },
    "proposal_id": {
      "type": "string",
      "pattern": "^ETERNAL-PROP-[0-9]{3,}$"
    },
    "title": {
      "type": "string",
      "minLength": 5,
      "maxLength": 200
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-((0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))?$"
    },
    "status": {
      "type": "string",
      "enum": [
        "DRAFT",
        "PROPOSED",
        "UNDER_REVIEW",
        "DECISION_PENDING",
        "APPROVED",
        "EFFECTIVE",
        "REJECTED",
        "WITHDRAWN",
        "SUPERSEDED",
        "SUSPENDED"
      ]
    },
    "author": {
      "type": "object",
      "required": ["id", "role", "name"],
      "properties": {
        "id": { "type": "string" },
        "role": {
          "type": "string",
          "enum": [
            "HUMAN_FOUNDER",
            "HUMAN_TRUSTEE",
            "CONSTITUTIONAL_REVIEWER",
            "INDEPENDENT_AUDITOR",
            "AI_AGENT_PARTICIPANT",
            "COMMUNITY_CONTRIBUTOR"
          ]
        },
        "name": { "type": "string" },
        "trust_anchor": { "type": "string" },
        "signature_ref": { "type": "string" }
      },
      "additionalProperties": false
    },
    "target_baseline": {
      "type": "object",
      "required": ["charter_version", "target_scope"],
      "properties": {
        "charter_version": { "type": "string" },
        "target_scope": {
          "type": "string",
          "enum": ["AMENDMENT", "NEW_ARTICLE", "INTERPRETATION", "REPEAL"]
        },
        "affected_articles": {
          "type": "array",
          "items": { "type": "string" }
        }
      },
      "additionalProperties": false
    },
    "clauses": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["clause_id", "title", "content"],
        "properties": {
          "clause_id": { "type": "string" },
          "title": { "type": "string" },
          "content": { "type": "string", "minLength": 10 },
          "interpretations": {
            "type": "array",
            "items": { "type": "string" }
          }
        },
        "additionalProperties": false
      }
    },
    "rationale": {
      "type": "string",
      "minLength": 20
    },
    "dissent_summary": {
      "type": "string"
    },
    "evidence_manifest": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["uri", "sha256", "description"],
        "properties": {
          "uri": { "type": "string" },
          "sha256": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$"
          },
          "description": { "type": "string" }
        },
        "additionalProperties": false
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false
}
