{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cardnetwork.org/spec/v1.1/edge-schema.json",
  "title": "CNA Edge Schema",
  "description": "Schema for Card Network Architecture edges - typed connections between cards",
  "type": "object",
  "required": ["id", "type", "source", "target"],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the edge"
    },
    "type": {
      "type": "string",
      "enum": [
        "stack", "link", "embed", "branch", "sync", "depends", "produces",
        "requires_approval", "contradicts", "supersedes", "extends",
        "related", "reports_to", "references", "implements", "derives_from"
      ],
      "description": "Edge type determining relationship semantics"
    },
    "source": {
      "type": "string",
      "description": "Source card ID"
    },
    "target": {
      "type": "string",
      "description": "Target card ID"
    },
    "weight": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 1,
      "description": "Edge weight for traversal priority (0-1)"
    },
    "label": {
      "type": "string",
      "description": "Optional edge label for display"
    },
    "condition": {
      "type": "object",
      "description": "Condition for branch edges",
      "properties": {
        "field": { "type": "string" },
        "operator": { "type": "string", "enum": ["eq", "ne", "gt", "lt", "gte", "lte", "contains", "matches"] },
        "value": {}
      }
    },
    "metadata": {
      "type": "object",
      "description": "Additional edge metadata",
      "properties": {
        "created": { "type": "string", "format": "date-time" },
        "author": { "type": "string" },
        "notes": { "type": "string" }
      }
    },
    "style": {
      "type": "object",
      "description": "Visual styling for edge rendering",
      "properties": {
        "color": { "type": "string" },
        "width": { "type": "number" },
        "dashed": { "type": "boolean" },
        "animated": { "type": "boolean" }
      }
    }
  }
}