{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bellatorsi-com/json-schema/bellatorsi-com-schedule-request-schema.json",
  "title": "ScheduleRequest",
  "description": "Request model for schedule analysis.\n\nThis is the base schedule payload used across all Tier 1 and Tier 2 APIs.\nAdditional Tier 2-specific fields enable full DCMA 14-Point compliance.",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bellatorsi-com-openapi.json#/components/schemas/ScheduleRequest",
  "properties": {
    "tasks": {
      "items": {
        "$ref": "#/$defs/Task"
      },
      "type": "array",
      "maxItems": 100000,
      "title": "Tasks",
      "description": "List of tasks in the schedule"
    },
    "start_task_ids": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Start Task Ids",
      "description": "Task IDs that anchor the project start (DCMA Check #1). If empty, tasks with no predecessors are treated as start tasks."
    },
    "finish_task_ids": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Finish Task Ids",
      "description": "Task IDs that anchor the project finish (DCMA Check #1). If empty, tasks with no successors are treated as finish tasks."
    },
    "status_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Status Date",
      "description": "Data date / status date for progress validation (ISO 8601 YYYY-MM-DD)"
    },
    "target_finish_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Finish Date",
      "description": "Target project finish date or key milestone date for CPLI calculation (ISO 8601)"
    },
    "baseline_approved_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Baseline Approved Date",
      "description": "Date when baseline was approved (for governance tracking)"
    },
    "resource_availability": {
      "items": {
        "$ref": "#/$defs/app__models__schemas__ResourceAvailability__1"
      },
      "type": "array",
      "title": "Resource Availability",
      "description": "Per-resource availability for over-allocation detection (Resource Analysis API)."
    },
    "options": {
      "$ref": "#/$defs/ValidationOptions",
      "description": "Validation options including Probability of Performance (v0.2.0)."
    }
  },
  "type": "object",
  "required": [
    "tasks"
  ],
  "$defs": {
    "DependencyLink": {
      "properties": {
        "task_id": {
          "type": "string",
          "title": "Task Id",
          "description": "Predecessor task ID"
        },
        "relationship_type": {
          "$ref": "#/$defs/RelationshipType",
          "description": "Relationship type (FS/SS/FF/SF)",
          "default": "FS"
        },
        "lag_days": {
          "type": "number",
          "title": "Lag Days",
          "description": "Lag (positive) or lead (negative) in days",
          "default": 0.0
        },
        "is_external": {
          "type": "boolean",
          "title": "Is External",
          "description": "True if link to external project file",
          "default": false
        },
        "external_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "External Path",
          "description": "Path to external file if is_external=True"
        }
      },
      "type": "object",
      "required": [
        "task_id"
      ],
      "title": "DependencyLink",
      "description": "Rich dependency link with relationship type and lag/lead.\n\nSupports parsing from various scheduling tool formats including:\n- MS Project: \"10FS+5 d\", \"/path/file.mpp/10FS+5 d\"\n- Primavera P6: Similar format with XER encoding\n- Server-based: \"<ServerFile>10FS+5 d\"\n- Simple: \"10\" (defaults to FS with zero lag)\n\nExamples:\n    >>> DependencyLink(task_id=\"10\", relationship_type=\"FS\", lag_days=5.0)\n    >>> DependencyLink.from_string(\"10FS+5 d\")\n    >>> DependencyLink.from_string(\"15SS-2 d\")"
    },
    "RelationshipType": {
      "type": "string",
      "enum": [
        "FS",
        "SS",
        "FF",
        "SF"
      ],
      "title": "RelationshipType",
      "description": "Task relationship types per PMBOK 6.3.2.2.\n\nAttributes:\n    FINISH_START: Predecessor finish → successor start (most common, ~90%)\n    START_START: Predecessor start → successor start (~5%)\n    FINISH_FINISH: Predecessor finish → successor finish (~4%)\n    START_FINISH: Predecessor start → successor finish (rare, ~1%)"
    },
    "Task": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Unique task identifier"
        },
        "duration_days": {
          "type": "number",
          "minimum": 0.0,
          "title": "Duration Days",
          "description": "Task duration in days",
          "default": 0
        },
        "predecessors": {
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "$ref": "#/$defs/DependencyLink"
              }
            ]
          },
          "type": "array",
          "title": "Predecessors",
          "description": "List of predecessor task IDs or dependency links. Supports: 'T1', 'T1FS+5 d', 'T2SS-2 d', or DependencyLink objects"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name",
          "description": "Task name"
        },
        "resource": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resource",
          "description": "Resource assigned to task"
        },
        "resources": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Resources",
          "description": "List of resources assigned (for multi-resource tasks)"
        },
        "percent_complete": {
          "type": "number",
          "maximum": 100.0,
          "minimum": 0.0,
          "title": "Percent Complete",
          "description": "Percent complete (0-100)",
          "default": 0
        },
        "physical_percent_complete": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 100.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Physical Percent Complete",
          "description": "Physical percent complete (0-100). Manual EVM entry by scheduler (MSP PhysicalPercentComplete). Authoritative for BCWP calculations. Captured separately from percent_complete on MSP imports."
        },
        "planned_start": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Planned Start",
          "description": "Planned start date (ISO 8601)"
        },
        "planned_finish": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Planned Finish",
          "description": "Planned finish date (ISO 8601)"
        },
        "actual_start": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actual Start",
          "description": "Actual start date (ISO 8601)"
        },
        "actual_finish": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actual Finish",
          "description": "Actual finish date (ISO 8601)"
        },
        "baseline_start": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Baseline Start",
          "description": "Baseline start date (ISO 8601)"
        },
        "baseline_finish": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Baseline Finish",
          "description": "Baseline finish date (ISO 8601)"
        },
        "constraint_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Constraint Type",
          "description": "Constraint type: ASAP, ALAP, SNET, SNLT, FNET, FNLT, MSO, MFO"
        },
        "constraint_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Constraint Date",
          "description": "Constraint date if applicable (ISO 8601)"
        },
        "task_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Task Type",
          "description": "Task type classification. Valid values: task (default), milestone, loe, summary, schedule_margin, planning_package, slpp, schedule_visibility. Drives DCMA check exclusions per PAM 200.1 § 3.2."
        },
        "wbs_code": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ],
          "title": "Wbs Code",
          "description": "WBS code (e.g., '1.2.3')"
        },
        "organization_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Organization Code",
          "description": "Org/dept identifier for anomaly categorization (Progress Audit)"
        },
        "custom_field_map": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Custom Field Map",
          "description": "All WBS/OBS-pattern custom fields discovered in this MS Project file, keyed by alias (e.g., 'CWBS', 'OBS'). Null for XER imports or when no matching aliases exist."
        },
        "forecast_start": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Forecast Start",
          "description": "Current forecast start date (ISO 8601)"
        },
        "forecast_finish": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Forecast Finish",
          "description": "Current forecast finish date (ISO 8601)"
        },
        "total_float_days": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total Float Days",
          "description": "Pre-computed total float in days. Auto-computed by CPM if absent."
        },
        "baseline_duration_days": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Baseline Duration Days",
          "description": "Baseline duration in days. Auto-computed from baseline dates if absent."
        },
        "delay_category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delay Category",
          "description": "Delay attribution category. Valid values: owner, contractor, design, procurement, weather, force_majeure."
        },
        "earned_value": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Earned Value",
          "description": "Earned Value (BCWP) in cost units. Requires options.include_ev_validation."
        },
        "budgeted_cost": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Budgeted Cost",
          "description": "Budgeted Cost of Work Scheduled (BCWS) in cost units."
        },
        "approval_required": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Approval Required",
          "description": "Whether this task requires explicit approval before it can start."
        },
        "approval_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Approval Status",
          "description": "Approval workflow state. Valid values: not_required, pending, approved, rejected."
        }
      },
      "type": "object",
      "required": [
        "id"
      ],
      "title": "Task",
      "description": "Unified task model for all schedule analysis endpoints.\n\nThis model is used across all Tier 1 and Tier 2 APIs. Fields are optional\nunless specifically required by an endpoint.\n\nField Naming Rationale:\n- duration_days: Explicit time unit (vs generic \"duration\")\n- predecessors: Standard scheduling terminology (vs generic \"dependencies\")\n\nDependency Format Support:\n- Simple: [\"task1\", \"task2\"]\n- Rich: [\"task1FS+5 d\", \"task2SS-2 d\"]\n- Objects: [DependencyLink(...), ...]"
    },
    "ValidationOptions": {
      "properties": {
        "calculate_pop": {
          "type": "boolean",
          "title": "Calculate Pop",
          "description": "Calculate Probability of Performance (PoP) score (v0.2.0).",
          "default": false
        },
        "include_pop_details": {
          "type": "boolean",
          "title": "Include Pop Details",
          "description": "Include dimensional PoP breakdown in response.",
          "default": true
        },
        "strict_mode": {
          "type": "boolean",
          "title": "Strict Mode",
          "description": "Treat warnings as errors (fail validation on any issue).",
          "default": false
        },
        "check_dcma_compliance": {
          "type": "boolean",
          "title": "Check Dcma Compliance",
          "description": "Include DCMA-specific checks (#1, #8).",
          "default": true
        }
      },
      "type": "object",
      "title": "ValidationOptions",
      "description": "Options for POST /api/v1/schedule/validate (v0.2.0)."
    },
    "app__models__schemas__ResourceAvailability__1": {
      "properties": {
        "resource_name": {
          "type": "string",
          "title": "Resource Name",
          "description": "Resource name (must match tasks[*].resources)"
        },
        "available_from": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Available From",
          "description": "Start of availability window (ISO 8601). Null = project start."
        },
        "available_to": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Available To",
          "description": "End of availability window (ISO 8601). Null = project finish."
        },
        "units_per_day": {
          "type": "number",
          "minimum": 0.0,
          "title": "Units Per Day",
          "description": "Available resource-units per working day (default: 1.0 = 100%)",
          "default": 1.0
        }
      },
      "type": "object",
      "required": [
        "resource_name"
      ],
      "title": "ResourceAvailability",
      "description": "Per-resource availability window for Resource Analysis.\n\nSpecifies how many units of a resource are available over a date range.\nresource_name must match a value appearing in tasks[*].resources."
    }
  }
}