{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "tenantpilot://contracts/042/dependency-edge.schema.json",
  "title": "DependencyEdge",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "tenant_id",
    "source_type",
    "source_id",
    "target_type",
    "relationship_type"
  ],
  "properties": {
    "tenant_id": { "type": "integer" },
    "source_type": { "type": "string", "enum": ["inventory_item", "foundation_object"] },
    "source_id": { "type": "string" },
    "target_type": { "type": "string", "enum": ["inventory_item", "foundation_object", "missing"] },
    "target_id": { "type": ["string", "null"] },
    "relationship_type": { "type": "string", "enum": ["assigned_to", "assigned_to_include", "assigned_to_exclude", "uses_assignment_filter", "scoped_by", "targets", "depends_on"] },
    "metadata": {
      "type": ["object", "null"],
      "additionalProperties": true,
      "properties": {
        "last_known_name": { "type": ["string", "null"] },
        "raw_ref": {},
        "foundation_type": { "type": "string", "enum": ["aad_group", "scope_tag", "device_category", "assignment_filter"] },
        "filter_mode": { "type": ["string", "null"], "enum": ["include", "exclude", null] }
      }
    },
    "created_at": { "type": ["string", "null"], "description": "ISO-8601 timestamp" },
    "updated_at": { "type": ["string", "null"], "description": "ISO-8601 timestamp" }
  }
}
