{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/business-domain-graph.v1.json",
  "title": "Agoragentic Business Domain Graph",
  "description": "Graph artifact describing business domains, flows, and process steps that can inform a deployment contract draft after owner review.",
  "type": "object",
  "required": ["schema", "graph_id", "domains", "business_flows", "review", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.business-domain-graph.v1" },
    "graph_id": { "type": "string" },
    "domains": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["domain_id", "name"],
        "properties": {
          "domain_id": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": ["string", "null"] },
          "owner_persona": { "type": ["string", "null"] },
          "source_refs": { "type": "array", "items": { "type": "string" } },
          "receipt_refs": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "business_flows": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["flow_id", "name"],
        "properties": {
          "flow_id": { "type": "string" },
          "name": { "type": "string" },
          "domain_id": { "type": ["string", "null"] },
          "goal": { "type": ["string", "null"] },
          "process_steps": { "type": "array" },
          "policies": { "type": "array" },
          "receipts": { "type": "array" },
          "marketplace_exposure": { "type": "boolean" }
        }
      }
    },
    "process_steps": { "type": "array" },
    "deployment_contract_hints": { "type": "array" },
    "review": {
      "type": "object",
      "properties": {
        "owner_review_required": { "const": true },
        "trap_scan_required": { "const": true },
        "policy_mapping_required": { "const": true }
      }
    },
    "public_boundary": {
      "type": "object",
      "properties": {
        "graph_artifact_only": { "const": true },
        "deployment_contract_created": { "const": false },
        "deployment_policy_mutated": { "const": false },
        "marketplace_publication_triggered": { "const": false },
        "x402_route_created": { "const": false },
        "wallet_spend_triggered": { "const": false },
        "settlement_triggered": { "const": false },
        "trust_mutated": { "const": false }
      }
    }
  },
  "additionalProperties": true
}
