{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bellatorsi-com/json-schema/bellatorsi-com-bellator-response-as-planned-vs-as-built-data-schema.json",
  "title": "BellatorResponse[AsPlannedVsAsBuiltData]",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bellatorsi-com-forensics-api-openapi.yml#/components/schemas/BellatorResponse_AsPlannedVsAsBuiltData_",
  "properties": {
    "status": {
      "$ref": "#/$defs/ResponseStatus"
    },
    "score": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 100.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Score"
    },
    "grade": {
      "anyOf": [
        {
          "$ref": "#/$defs/Grade"
        },
        {
          "type": "null"
        }
      ]
    },
    "summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Summary"
    },
    "breakdown": {
      "anyOf": [
        {
          "additionalProperties": {
            "$ref": "#/$defs/ScoreComponent"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Breakdown"
    },
    "findings": {
      "items": {
        "$ref": "#/$defs/Finding"
      },
      "type": "array",
      "title": "Findings"
    },
    "recommendations": {
      "items": {
        "$ref": "#/$defs/Recommendation"
      },
      "type": "array",
      "title": "Recommendations"
    },
    "data": {
      "anyOf": [
        {
          "$ref": "#/$defs/AsPlannedVsAsBuiltData"
        },
        {
          "type": "null"
        }
      ]
    },
    "simulation": {
      "anyOf": [
        {
          "$ref": "#/$defs/SimulationEnvelope"
        },
        {
          "type": "null"
        }
      ]
    },
    "metadata": {
      "$ref": "#/$defs/ResponseMetadata"
    }
  },
  "type": "object",
  "required": [
    "status",
    "metadata"
  ],
  "$defs": {
    "AddedRelationship": {
      "properties": {
        "predecessor_id": {
          "type": "string",
          "title": "Predecessor Id"
        },
        "successor_id": {
          "type": "string",
          "title": "Successor Id"
        },
        "relationship_type": {
          "type": "string",
          "title": "Relationship Type",
          "default": "FS"
        },
        "lag_days": {
          "type": "integer",
          "title": "Lag Days",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "predecessor_id",
        "successor_id"
      ],
      "title": "AddedRelationship",
      "description": "A dependency added in the as-built schedule."
    },
    "AsPlannedVsAsBuiltData": {
      "properties": {
        "summary": {
          "$ref": "#/$defs/AsPlannedVsAsBuiltSummary"
        },
        "task_comparisons": {
          "items": {
            "$ref": "#/$defs/TaskComparison"
          },
          "type": "array",
          "title": "Task Comparisons"
        },
        "unmatched_planned_tasks": {
          "items": {
            "$ref": "#/$defs/UnmatchedPlannedTask"
          },
          "type": "array",
          "title": "Unmatched Planned Tasks"
        },
        "unmatched_built_tasks": {
          "items": {
            "$ref": "#/$defs/UnmatchedBuiltTask"
          },
          "type": "array",
          "title": "Unmatched Built Tasks"
        },
        "logic_diff": {
          "anyOf": [
            {
              "$ref": "#/$defs/LogicDiff"
            },
            {
              "type": "null"
            }
          ]
        },
        "critical_path_overlay": {
          "anyOf": [
            {
              "$ref": "#/$defs/CriticalPathOverlay"
            },
            {
              "type": "null"
            }
          ]
        },
        "resource_diff": {
          "anyOf": [
            {
              "$ref": "#/$defs/ResourceDiff"
            },
            {
              "type": "null"
            }
          ]
        },
        "processing_metadata": {
          "additionalProperties": true,
          "type": "object",
          "title": "Processing Metadata"
        }
      },
      "type": "object",
      "title": "AsPlannedVsAsBuiltData",
      "description": "Data payload for POST /api/v1/forensics/as-planned-vs-as-built."
    },
    "AsPlannedVsAsBuiltSummary": {
      "properties": {
        "as_planned_task_count": {
          "type": "integer",
          "title": "As Planned Task Count",
          "default": 0
        },
        "as_built_task_count": {
          "type": "integer",
          "title": "As Built Task Count",
          "default": 0
        },
        "matched_tasks": {
          "type": "integer",
          "title": "Matched Tasks",
          "default": 0
        },
        "unmatched_planned_tasks": {
          "type": "integer",
          "title": "Unmatched Planned Tasks",
          "default": 0
        },
        "unmatched_built_tasks": {
          "type": "integer",
          "title": "Unmatched Built Tasks",
          "default": 0
        },
        "on_time_completion_rate": {
          "type": "number",
          "title": "On Time Completion Rate",
          "default": 0.0
        },
        "avg_start_variance_days": {
          "type": "number",
          "title": "Avg Start Variance Days",
          "default": 0.0
        },
        "avg_finish_variance_days": {
          "type": "number",
          "title": "Avg Finish Variance Days",
          "default": 0.0
        },
        "avg_duration_variance_days": {
          "type": "number",
          "title": "Avg Duration Variance Days",
          "default": 0.0
        },
        "total_project_slippage_days": {
          "type": "integer",
          "title": "Total Project Slippage Days",
          "default": 0
        },
        "critical_path_overlap_pct": {
          "type": "number",
          "title": "Critical Path Overlap Pct",
          "default": 0.0
        },
        "loe_excluded_count": {
          "type": "integer",
          "title": "Loe Excluded Count",
          "default": 0
        }
      },
      "type": "object",
      "title": "AsPlannedVsAsBuiltSummary",
      "description": "High-level comparison statistics."
    },
    "CriticalPathOverlay": {
      "properties": {
        "planned_critical_path": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Planned Critical Path"
        },
        "actual_critical_path": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Actual Critical Path"
        },
        "tasks_maintained_on_cp": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Tasks Maintained On Cp"
        },
        "tasks_gained_criticality": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Tasks Gained Criticality"
        },
        "tasks_lost_criticality": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Tasks Lost Criticality"
        },
        "path_divergence_score": {
          "type": "number",
          "title": "Path Divergence Score",
          "default": 0.0
        }
      },
      "type": "object",
      "title": "CriticalPathOverlay",
      "description": "Comparison of planned vs. actual critical paths."
    },
    "Finding": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code",
          "description": "Stable machine-readable identifier e.g. DCMA_CHECK_8_HIGH_DURATION"
        },
        "severity": {
          "$ref": "#/$defs/FindingSeverity"
        },
        "title": {
          "type": "string",
          "title": "Title",
          "description": "Short human-readable label"
        },
        "description": {
          "type": "string",
          "title": "Description",
          "description": "Full explanation of the issue"
        },
        "standard": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Standard",
          "description": "Standard citation e.g. 'DCMA PAM 200.1 Check #8'"
        },
        "affected_tasks": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Affected Tasks",
          "description": "Task IDs implicated by this finding"
        },
        "metric_value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Metric Value",
          "description": "Observed measurement e.g. 60.0 days"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Threshold",
          "description": "Threshold that was violated e.g. 44.0 days"
        }
      },
      "type": "object",
      "required": [
        "code",
        "severity",
        "title",
        "description"
      ],
      "title": "Finding",
      "description": "A discrete, machine-readable issue identified during analysis.\n\n`code` values are stable across versions; consumers may key logic on them.\nPattern: {STANDARD}_{CHECK_ID}_{SHORT_DESCRIPTION} in SCREAMING_SNAKE_CASE."
    },
    "FindingSeverity": {
      "type": "string",
      "enum": [
        "critical",
        "high",
        "medium",
        "low",
        "info"
      ],
      "title": "FindingSeverity",
      "description": "Severity level for findings; reused as priority level for recommendations."
    },
    "Grade": {
      "type": "string",
      "enum": [
        "A",
        "B",
        "C",
        "D",
        "F"
      ],
      "title": "Grade",
      "description": "Letter grade derived from a 0–100 score. Null on non-scoring endpoints."
    },
    "LogicDiff": {
      "properties": {
        "added_relationships": {
          "items": {
            "$ref": "#/$defs/AddedRelationship"
          },
          "type": "array",
          "title": "Added Relationships"
        },
        "removed_relationships": {
          "items": {
            "$ref": "#/$defs/RemovedRelationship"
          },
          "type": "array",
          "title": "Removed Relationships"
        },
        "modified_relationships": {
          "items": {
            "$ref": "#/$defs/ModifiedRelationship"
          },
          "type": "array",
          "title": "Modified Relationships"
        },
        "total_relationship_changes": {
          "type": "integer",
          "title": "Total Relationship Changes",
          "default": 0
        },
        "logic_change_severity": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high",
            "critical"
          ],
          "title": "Logic Change Severity",
          "default": "low"
        }
      },
      "type": "object",
      "title": "LogicDiff",
      "description": "Dependency graph changes between as-planned and as-built."
    },
    "ModifiedRelationship": {
      "properties": {
        "predecessor_id": {
          "type": "string",
          "title": "Predecessor Id"
        },
        "successor_id": {
          "type": "string",
          "title": "Successor Id"
        },
        "planned_type": {
          "type": "string",
          "title": "Planned Type"
        },
        "actual_type": {
          "type": "string",
          "title": "Actual Type"
        },
        "planned_lag": {
          "type": "integer",
          "title": "Planned Lag",
          "default": 0
        },
        "actual_lag": {
          "type": "integer",
          "title": "Actual Lag",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "predecessor_id",
        "successor_id",
        "planned_type",
        "actual_type"
      ],
      "title": "ModifiedRelationship",
      "description": "A dependency whose type or lag changed."
    },
    "PercentileResult": {
      "properties": {
        "p10": {
          "type": "number",
          "title": "P10",
          "description": "10th percentile outcome"
        },
        "p50": {
          "type": "number",
          "title": "P50",
          "description": "50th percentile (median)"
        },
        "p80": {
          "type": "number",
          "title": "P80",
          "description": "80th percentile — common contract delivery threshold"
        },
        "p90": {
          "type": "number",
          "title": "P90",
          "description": "90th percentile"
        },
        "mean": {
          "type": "number",
          "title": "Mean"
        },
        "std_dev": {
          "type": "number",
          "title": "Std Dev"
        }
      },
      "type": "object",
      "required": [
        "p10",
        "p50",
        "p80",
        "p90",
        "mean",
        "std_dev"
      ],
      "title": "PercentileResult",
      "description": "Percentile distribution across simulation trials.\n\nReserved for Tier 3 Monte Carlo / risk simulation endpoints (v0.3.0+)."
    },
    "Recommendation": {
      "properties": {
        "priority": {
          "$ref": "#/$defs/FindingSeverity"
        },
        "action": {
          "type": "string",
          "title": "Action",
          "description": "What to do — specific and actionable"
        },
        "standard": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Standard",
          "description": "Supporting standard citation"
        },
        "finding_codes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Finding Codes",
          "description": "Finding.code values this recommendation addresses"
        }
      },
      "type": "object",
      "required": [
        "priority",
        "action"
      ],
      "title": "Recommendation",
      "description": "An actionable item tied to one or more findings.\n\n`finding_codes` links each recommendation back to the specific Finding(s)\nit addresses, enabling consumers to correlate actions with evidence."
    },
    "RemovedRelationship": {
      "properties": {
        "predecessor_id": {
          "type": "string",
          "title": "Predecessor Id"
        },
        "successor_id": {
          "type": "string",
          "title": "Successor Id"
        },
        "planned_type": {
          "type": "string",
          "title": "Planned Type",
          "default": "FS"
        }
      },
      "type": "object",
      "required": [
        "predecessor_id",
        "successor_id"
      ],
      "title": "RemovedRelationship",
      "description": "A dependency removed from the as-planned schedule."
    },
    "ResourceDiff": {
      "properties": {
        "planned_resources": {
          "additionalProperties": {
            "type": "integer"
          },
          "type": "object",
          "title": "Planned Resources"
        },
        "actual_resources": {
          "additionalProperties": {
            "type": "integer"
          },
          "type": "object",
          "title": "Actual Resources"
        },
        "added_resources": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Added Resources"
        },
        "removed_resources": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Removed Resources"
        },
        "utilization_variance_pct": {
          "additionalProperties": {
            "type": "number"
          },
          "type": "object",
          "title": "Utilization Variance Pct"
        }
      },
      "type": "object",
      "title": "ResourceDiff",
      "description": "Resource allocation changes between as-planned and as-built."
    },
    "ResponseMetadata": {
      "properties": {
        "task_count": {
          "type": "integer",
          "title": "Task Count",
          "description": "Number of tasks in the submitted schedule"
        },
        "processing_time_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Processing Time Ms",
          "description": "Wall-clock processing time in milliseconds"
        },
        "api_version": {
          "type": "string",
          "title": "Api Version",
          "description": "API version that produced this response",
          "default": "v0.2.0"
        },
        "endpoint": {
          "type": "string",
          "title": "Endpoint",
          "description": "Endpoint path e.g. /api/v1/health/score"
        },
        "standards_applied": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Standards Applied",
          "description": "Standards consulted during analysis e.g. ['DCMA PAM 200.1', 'GAO BP-2']"
        },
        "confidence": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Confidence",
          "description": "Confidence in the result (0–1). Present on scoring endpoints."
        },
        "status_date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status Date",
          "description": "ISO date used as analysis reference point. Present on time-aware analyses."
        }
      },
      "type": "object",
      "required": [
        "task_count",
        "endpoint"
      ],
      "title": "ResponseMetadata",
      "description": "Audit trail and processing context — always present, never null."
    },
    "ResponseStatus": {
      "type": "string",
      "enum": [
        "pass",
        "fail",
        "warning",
        "info"
      ],
      "title": "ResponseStatus",
      "description": "Top-level result status — always present in every response."
    },
    "ScoreComponent": {
      "properties": {
        "score": {
          "type": "number",
          "maximum": 100.0,
          "minimum": 0.0,
          "title": "Score",
          "description": "Dimension score 0–100"
        },
        "weight": {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0,
          "title": "Weight",
          "description": "Contribution weight (all weights sum to 1.0)"
        },
        "label": {
          "type": "string",
          "title": "Label",
          "description": "Human-readable dimension name"
        },
        "detail": {
          "additionalProperties": true,
          "type": "object",
          "title": "Detail",
          "description": "Computed inputs that drove this score — the defensible justification layer"
        }
      },
      "type": "object",
      "required": [
        "score",
        "weight",
        "label"
      ],
      "title": "ScoreComponent",
      "description": "One named dimension in a breakdown dict.\n\nThe `detail` field carries the computed inputs that drove this score —\ncounts, percentages, threshold values, standard references.  It is\nintentionally open so each dimension can surface whatever is relevant\nwithout a fixed sub-schema."
    },
    "SimulationEnvelope": {
      "properties": {
        "method": {
          "type": "string",
          "title": "Method",
          "description": "Simulation method: monte_carlo | latin_hypercube"
        },
        "trial_count": {
          "type": "integer",
          "title": "Trial Count"
        },
        "duration_days": {
          "anyOf": [
            {
              "$ref": "#/$defs/PercentileResult"
            },
            {
              "type": "null"
            }
          ]
        },
        "cost": {
          "anyOf": [
            {
              "$ref": "#/$defs/PercentileResult"
            },
            {
              "type": "null"
            }
          ]
        },
        "completion_date": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completion Date",
          "description": "Map of p-value strings to ISO completion dates e.g. {'p50': '2027-04-15'}"
        }
      },
      "type": "object",
      "required": [
        "method",
        "trial_count"
      ],
      "title": "SimulationEnvelope",
      "description": "Probabilistic simulation outputs for Tier 3 endpoints.\n\nNull on all Tier 1 and Tier 2 responses.  When Tier 3 launches, this\nfield transitions from null to populated without changing any other\nenvelope field — existing consumers are unaffected."
    },
    "TaskComparison": {
      "properties": {
        "task_id": {
          "type": "string",
          "title": "Task Id"
        },
        "task_name": {
          "type": "string",
          "title": "Task Name"
        },
        "match_confidence": {
          "type": "number",
          "title": "Match Confidence",
          "default": 1.0
        },
        "planned_start": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Planned Start"
        },
        "planned_finish": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Planned Finish"
        },
        "planned_duration_days": {
          "type": "integer",
          "title": "Planned Duration Days",
          "default": 0
        },
        "actual_start": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actual Start"
        },
        "actual_finish": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actual Finish"
        },
        "actual_duration_days": {
          "type": "integer",
          "title": "Actual Duration Days",
          "default": 0
        },
        "start_variance_days": {
          "type": "integer",
          "title": "Start Variance Days",
          "default": 0
        },
        "finish_variance_days": {
          "type": "integer",
          "title": "Finish Variance Days",
          "default": 0
        },
        "duration_variance_days": {
          "type": "integer",
          "title": "Duration Variance Days",
          "default": 0
        },
        "variance_classification": {
          "type": "string",
          "enum": [
            "early_completion",
            "on_time",
            "minor_slip",
            "moderate_slip",
            "severe_slip",
            "incomplete"
          ],
          "title": "Variance Classification",
          "default": "on_time"
        },
        "on_planned_critical_path": {
          "type": "boolean",
          "title": "On Planned Critical Path",
          "default": false
        },
        "on_actual_critical_path": {
          "type": "boolean",
          "title": "On Actual Critical Path",
          "default": false
        },
        "critical_path_status": {
          "type": "string",
          "enum": [
            "maintained",
            "gained_criticality",
            "lost_criticality",
            "not_critical"
          ],
          "title": "Critical Path Status",
          "default": "not_critical"
        }
      },
      "type": "object",
      "required": [
        "task_id",
        "task_name"
      ],
      "title": "TaskComparison",
      "description": "Per-task as-planned vs. as-built comparison."
    },
    "UnmatchedBuiltTask": {
      "properties": {
        "task_id": {
          "type": "string",
          "title": "Task Id"
        },
        "task_name": {
          "type": "string",
          "title": "Task Name"
        },
        "actual_start": {
          "type": "string",
          "title": "Actual Start",
          "default": ""
        },
        "actual_finish": {
          "type": "string",
          "title": "Actual Finish",
          "default": ""
        },
        "reason": {
          "type": "string",
          "title": "Reason",
          "default": "added_during_execution"
        }
      },
      "type": "object",
      "required": [
        "task_id",
        "task_name"
      ],
      "title": "UnmatchedBuiltTask",
      "description": "An as-built task with no as-planned counterpart."
    },
    "UnmatchedPlannedTask": {
      "properties": {
        "task_id": {
          "type": "string",
          "title": "Task Id"
        },
        "task_name": {
          "type": "string",
          "title": "Task Name"
        },
        "planned_start": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Planned Start"
        },
        "planned_finish": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Planned Finish"
        },
        "reason": {
          "type": "string",
          "title": "Reason",
          "default": "not_executed"
        }
      },
      "type": "object",
      "required": [
        "task_id",
        "task_name"
      ],
      "title": "UnmatchedPlannedTask",
      "description": "An as-planned task with no as-built counterpart."
    }
  }
}