{
  "id": "business-operations",
  "title": "Business operations",
  "eyebrow": "Delivery readiness and capacity",
  "summary": "Find service jobs with a capacity-qualified team, then inspect dispatch review separately.",
  "businessQuestion": "Which delivery options meet the recorded operating conditions, and which ready jobs still await review?",
  "scopeNote": "Fictional read-only snapshot at 2026-10-07 12:00 UTC. Individual capacity comparisons do not allocate shared hours, verify licenses, optimize routes, or grant dispatch permission.",
  "keyDistinctions": [
    "A candidate team is an option, not an assignment or capacity reservation.",
    "Ready work and available capacity do not establish dispatch approval.",
    "Recorded approval does not prove work completion or independently verified authority.",
    "An absent or stale required claim is uncertainty, not a negative fact."
  ],
  "sources": [
    {
      "id": "job-system",
      "label": "Service job register",
      "system": "Job management",
      "description": "Fictional job readiness, effort, site, and candidate-team records."
    },
    {
      "id": "team-roster",
      "label": "Team capacity snapshot",
      "system": "Workforce planning",
      "description": "Fictional availability, skills, and remaining team hours in one planning window."
    },
    {
      "id": "service-catalog",
      "label": "Service catalog",
      "system": "Service operations",
      "description": "Fictional service definitions and team catalog links."
    },
    {
      "id": "approval-log",
      "label": "Dispatch review log",
      "system": "Approval workflow",
      "description": "Fictional recorded review states; no operational authority validation."
    }
  ],
  "records": [
    {
      "id": "job-riverside",
      "type": "service_job",
      "label": "Riverside inspection",
      "properties": {
        "job_id": "JOB-101",
        "ready": true,
        "materials_ready": true,
        "required_hours": 4,
        "required_skill": "inspection"
      },
      "sourceId": "job-system"
    },
    {
      "id": "job-harbor",
      "type": "service_job",
      "label": "Harbor inspection",
      "properties": {
        "job_id": "JOB-102",
        "ready": true,
        "materials_ready": false,
        "required_hours": 3,
        "required_skill": "inspection"
      },
      "sourceId": "job-system"
    },
    {
      "id": "job-linden",
      "type": "service_job",
      "label": "Linden inspection",
      "properties": {
        "job_id": "JOB-103",
        "ready": true,
        "materials_ready": true,
        "required_hours": 7,
        "required_skill": "inspection"
      },
      "sourceId": "job-system"
    },
    {
      "id": "team-maple",
      "type": "team",
      "label": "Maple team",
      "properties": {
        "team_id": "TEAM-01",
        "available": true,
        "capacity_hours": 6,
        "skills": [
          "inspection"
        ]
      },
      "sourceId": "team-roster"
    },
    {
      "id": "team-oak",
      "type": "team",
      "label": "Oak team",
      "properties": {
        "team_id": "TEAM-02",
        "available": true,
        "capacity_hours": 8,
        "skills": [
          "inspection"
        ]
      },
      "sourceId": "team-roster"
    },
    {
      "id": "site-riverside",
      "type": "site",
      "label": "Riverside offices",
      "properties": {
        "site_id": "SITE-01",
        "name": "Riverside offices"
      },
      "sourceId": "job-system"
    },
    {
      "id": "site-harbor",
      "type": "site",
      "label": "Harbor warehouse",
      "properties": {
        "site_id": "SITE-02",
        "name": "Harbor warehouse"
      },
      "sourceId": "job-system"
    },
    {
      "id": "site-linden",
      "type": "site",
      "label": "Linden clinic",
      "properties": {
        "site_id": "SITE-03",
        "name": "Linden clinic"
      },
      "sourceId": "job-system"
    },
    {
      "id": "service-inspection",
      "type": "service",
      "label": "Equipment inspection",
      "properties": {
        "service_id": "SVC-01",
        "name": "Equipment inspection"
      },
      "sourceId": "service-catalog"
    },
    {
      "id": "approval-riverside",
      "type": "dispatch_approval",
      "label": "Riverside review",
      "properties": {
        "approval_id": "APR-101",
        "status": "pending",
        "reviewer_role": "dispatcher"
      },
      "sourceId": "approval-log"
    },
    {
      "id": "approval-harbor",
      "type": "dispatch_approval",
      "label": "Harbor review",
      "properties": {
        "approval_id": "APR-102",
        "status": "approved",
        "reviewer_role": "dispatcher"
      },
      "sourceId": "approval-log"
    },
    {
      "id": "approval-linden",
      "type": "dispatch_approval",
      "label": "Linden review",
      "properties": {
        "approval_id": "APR-103",
        "status": "approved",
        "reviewer_role": "dispatcher"
      },
      "sourceId": "approval-log"
    }
  ],
  "links": [
    {
      "id": "job-riverside.at_site",
      "from": "job-riverside",
      "property": "at_site",
      "to": "site-riverside",
      "sourceId": "job-system"
    },
    {
      "id": "job-riverside.needs_service",
      "from": "job-riverside",
      "property": "needs_service",
      "to": "service-inspection",
      "sourceId": "job-system"
    },
    {
      "id": "job-riverside.candidate_team",
      "from": "job-riverside",
      "property": "candidate_team",
      "to": "team-maple",
      "sourceId": "job-system"
    },
    {
      "id": "job-riverside.has_approval",
      "from": "job-riverside",
      "property": "has_approval",
      "to": "approval-riverside",
      "sourceId": "approval-log"
    },
    {
      "id": "job-harbor.at_site",
      "from": "job-harbor",
      "property": "at_site",
      "to": "site-harbor",
      "sourceId": "job-system"
    },
    {
      "id": "job-harbor.needs_service",
      "from": "job-harbor",
      "property": "needs_service",
      "to": "service-inspection",
      "sourceId": "job-system"
    },
    {
      "id": "job-harbor.candidate_team",
      "from": "job-harbor",
      "property": "candidate_team",
      "to": "team-oak",
      "sourceId": "job-system"
    },
    {
      "id": "job-harbor.has_approval",
      "from": "job-harbor",
      "property": "has_approval",
      "to": "approval-harbor",
      "sourceId": "approval-log"
    },
    {
      "id": "job-linden.at_site",
      "from": "job-linden",
      "property": "at_site",
      "to": "site-linden",
      "sourceId": "job-system"
    },
    {
      "id": "job-linden.needs_service",
      "from": "job-linden",
      "property": "needs_service",
      "to": "service-inspection",
      "sourceId": "job-system"
    },
    {
      "id": "job-linden.candidate_team",
      "from": "job-linden",
      "property": "candidate_team",
      "to": "team-maple",
      "sourceId": "job-system"
    },
    {
      "id": "job-linden.has_approval",
      "from": "job-linden",
      "property": "has_approval",
      "to": "approval-linden",
      "sourceId": "approval-log"
    },
    {
      "id": "team-maple.offers_service",
      "from": "team-maple",
      "property": "offers_service",
      "to": "service-inspection",
      "sourceId": "service-catalog"
    },
    {
      "id": "team-oak.offers_service",
      "from": "team-oak",
      "property": "offers_service",
      "to": "service-inspection",
      "sourceId": "service-catalog"
    }
  ],
  "questions": [
    {
      "id": "capacity_options",
      "title": "Which job/team options meet the recorded capacity conditions?",
      "explanation": "Riverside needs 4 hours and Maple has 6. Harbor lacks materials; Linden needs more hours than Maple has. This checks each candidate independently and does not reserve capacity.",
      "arguments": {},
      "definition": {
        "artifactVersion": "t2k.graph-function.v1",
        "functionRef": "example.business-operations:reasoning_function:capacity_options",
        "inputs": {},
        "output": {
          "kind": "rows",
          "fields": {
            "jobId": "string",
            "teamId": "string",
            "requiredHours": "number",
            "capacityHours": "number"
          }
        },
        "maxAgeSeconds": 3600,
        "limits": {
          "maxRows": 100,
          "maxWork": 10000
        },
        "steps": [
          {
            "id": "jobs",
            "op": "lookup",
            "typeRef": "example.business-operations:service_job",
            "as": "job"
          },
          {
            "id": "teams",
            "op": "traverse",
            "from": "jobs",
            "source": "job",
            "relation": "example.business-operations:relation:service_job:candidate_team:team",
            "direction": "outgoing",
            "as": "team"
          },
          {
            "id": "qualified",
            "op": "filter",
            "from": "teams",
            "all": [
              {
                "left": {
                  "binding": "job",
                  "property": "example.business-operations:service_job.ready"
                },
                "operator": "eq",
                "right": {
                  "literal": true
                }
              },
              {
                "left": {
                  "binding": "job",
                  "property": "example.business-operations:service_job.materials_ready"
                },
                "operator": "eq",
                "right": {
                  "literal": true
                }
              },
              {
                "left": {
                  "binding": "team",
                  "property": "example.business-operations:team.available"
                },
                "operator": "eq",
                "right": {
                  "literal": true
                }
              },
              {
                "left": {
                  "binding": "team",
                  "property": "example.business-operations:team.skills"
                },
                "operator": "contains",
                "right": {
                  "binding": "job",
                  "property": "example.business-operations:service_job.required_skill"
                }
              },
              {
                "left": {
                  "binding": "team",
                  "property": "example.business-operations:team.capacity_hours"
                },
                "operator": "gte",
                "right": {
                  "binding": "job",
                  "property": "example.business-operations:service_job.required_hours"
                }
              }
            ]
          },
          {
            "id": "options",
            "op": "project",
            "from": "qualified",
            "fields": {
              "jobId": {
                "entity": "job"
              },
              "teamId": {
                "entity": "team"
              },
              "requiredHours": {
                "binding": "job",
                "property": "example.business-operations:service_job.required_hours"
              },
              "capacityHours": {
                "binding": "team",
                "property": "example.business-operations:team.capacity_hours"
              }
            }
          }
        ],
        "return": "options"
      },
      "expected": {
        "status": "complete",
        "value": [
          {
            "jobId": "job-riverside",
            "teamId": "team-maple",
            "requiredHours": 4,
            "capacityHours": 6
          }
        ]
      },
      "variants": [
        {
          "id": "capacity_reduced",
          "label": "Reduce Maple capacity",
          "explanation": "Maple now has 3 hours, so no listed job/team option meets every condition.",
          "patches": [
            {
              "claimId": "team-maple.capacity_hours",
              "value": 3
            }
          ],
          "expected": {
            "status": "complete",
            "value": []
          }
        },
        {
          "id": "availability_missing",
          "label": "Remove Maple availability",
          "explanation": "Maple still has enough hours for Riverside, but missing availability cannot establish an option.",
          "patches": [
            {
              "claimId": "team-maple.available",
              "remove": true
            }
          ],
          "expected": {
            "status": "needs_review",
            "value": null
          }
        }
      ]
    },
    {
      "id": "pending_dispatch_reviews",
      "title": "Which ready jobs have a recorded pending dispatch review?",
      "explanation": "Riverside is ready with materials available but its review remains pending. Harbor has approval but its materials are not ready. Linden's approved review is excluded from this queue, regardless of its capacity shortfall.",
      "arguments": {},
      "definition": {
        "artifactVersion": "t2k.graph-function.v1",
        "functionRef": "example.business-operations:reasoning_function:pending_dispatch_reviews",
        "inputs": {},
        "output": {
          "kind": "rows",
          "fields": {
            "jobId": "string",
            "approvalId": "string",
            "reviewStatus": "string"
          }
        },
        "maxAgeSeconds": 3600,
        "limits": {
          "maxRows": 100,
          "maxWork": 10000
        },
        "steps": [
          {
            "id": "jobs",
            "op": "lookup",
            "typeRef": "example.business-operations:service_job",
            "as": "job"
          },
          {
            "id": "ready",
            "op": "filter",
            "from": "jobs",
            "all": [
              {
                "left": {
                  "binding": "job",
                  "property": "example.business-operations:service_job.ready"
                },
                "operator": "eq",
                "right": {
                  "literal": true
                }
              },
              {
                "left": {
                  "binding": "job",
                  "property": "example.business-operations:service_job.materials_ready"
                },
                "operator": "eq",
                "right": {
                  "literal": true
                }
              }
            ]
          },
          {
            "id": "reviews",
            "op": "traverse",
            "from": "ready",
            "source": "job",
            "relation": "example.business-operations:relation:service_job:has_approval:dispatch_approval",
            "direction": "outgoing",
            "as": "approval"
          },
          {
            "id": "pending",
            "op": "filter",
            "from": "reviews",
            "all": [
              {
                "left": {
                  "binding": "approval",
                  "property": "example.business-operations:dispatch_approval.status"
                },
                "operator": "eq",
                "right": {
                  "literal": "pending"
                }
              }
            ]
          },
          {
            "id": "review_queue",
            "op": "project",
            "from": "pending",
            "fields": {
              "jobId": {
                "entity": "job"
              },
              "approvalId": {
                "entity": "approval"
              },
              "reviewStatus": {
                "binding": "approval",
                "property": "example.business-operations:dispatch_approval.status"
              }
            }
          }
        ],
        "return": "review_queue"
      },
      "expected": {
        "status": "complete",
        "value": [
          {
            "jobId": "job-riverside",
            "approvalId": "approval-riverside",
            "reviewStatus": "pending"
          }
        ]
      },
      "variants": [
        {
          "id": "review_approved",
          "label": "Record the Riverside review as approved",
          "explanation": "The pending-review queue becomes empty; this still does not dispatch the job.",
          "patches": [
            {
              "claimId": "approval-riverside.status",
              "value": "approved"
            }
          ],
          "expected": {
            "status": "complete",
            "value": []
          }
        },
        {
          "id": "review_stale",
          "label": "Make the Riverside review stale",
          "explanation": "Its two-hour-old review exceeds the function's one-hour freshness limit.",
          "patches": [
            {
              "claimId": "approval-riverside.status",
              "observedAt": "2026-10-07T10:00:00Z"
            }
          ],
          "expected": {
            "status": "needs_review",
            "value": null
          }
        }
      ]
    }
  ]
}
