{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/krobar-ai/json-schema/krobar-ai-simulation-summary-response-schema.json",
  "title": "SimulationSummaryResponse",
  "description": "Response schema for simulation summary endpoint.",
  "x-generated": "2026-11-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/krobar-ai-openapi.json#/components/schemas/SimulationSummaryResponse",
  "properties": {
    "simulation_id": {
      "type": "string",
      "format": "uuid",
      "title": "Simulation Id",
      "description": "Simulation run ID"
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "Simulation run name"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Simulation run description"
    },
    "graph_id": {
      "type": "string",
      "format": "uuid",
      "title": "Graph Id",
      "description": "Graph ID"
    },
    "num_iterations": {
      "type": "integer",
      "title": "Num Iterations",
      "description": "Number of simulation iterations"
    },
    "time_period_unit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Time Period Unit",
      "description": "Unit of time for simulation periods (e.g., 'month')"
    },
    "graph_version": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Graph Version",
      "description": "Latest saved graph version snapshotted when the async run was created, if available"
    },
    "node_names": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Node Names",
      "description": "Node-name snapshot from the latest saved graph version, or from the current hydrated graph when no saved version exists"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "When the simulation was created"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At",
      "description": "When the simulation was last updated"
    },
    "summary_statistics": {
      "items": {
        "$ref": "#/$defs/TimePeriodData"
      },
      "type": "array",
      "title": "Summary Statistics",
      "description": "Summary statistics organized by time period, with nodes and edges for each period (fast access, <1MB)"
    },
    "scenario_analysis": {
      "$ref": "#/$defs/ScenarioAnalysis",
      "description": "Best, median, and worst case scenario analysis"
    },
    "result_size_bytes": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Result Size Bytes",
      "description": "Size of full results stored in S3"
    },
    "has_detailed_percentiles": {
      "type": "boolean",
      "title": "Has Detailed Percentiles",
      "description": "Whether detailed percentiles (1st-99th) are available"
    }
  },
  "type": "object",
  "required": [
    "simulation_id",
    "name",
    "description",
    "graph_id",
    "num_iterations",
    "created_at",
    "updated_at",
    "summary_statistics",
    "scenario_analysis",
    "result_size_bytes",
    "has_detailed_percentiles"
  ],
  "$defs": {
    "HistogramConfigurations": {
      "properties": {
        "summary": {
          "anyOf": [
            {
              "$ref": "#/$defs/HistogramData"
            },
            {
              "type": "null"
            }
          ],
          "description": "20-bucket histogram for summary view"
        },
        "detailed": {
          "anyOf": [
            {
              "$ref": "#/$defs/HistogramData"
            },
            {
              "type": "null"
            }
          ],
          "description": "100-bucket histogram for detailed analysis"
        }
      },
      "type": "object",
      "title": "HistogramConfigurations",
      "description": "Multiple histogram configurations for different visualization needs."
    },
    "HistogramData": {
      "properties": {
        "counts": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Counts",
          "description": "Count of values in each bin"
        },
        "bins": {
          "items": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "array",
          "title": "Bins",
          "description": "Bin edges (length = counts.length + 1), None values indicate invalid/infinite data points"
        },
        "bin_centers": {
          "items": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "array",
          "title": "Bin Centers",
          "description": "Center points of each bin, None values indicate invalid/infinite data points"
        },
        "range_min": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Range Min",
          "description": "Minimum value in the data range, None if invalid"
        },
        "range_max": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Range Max",
          "description": "Maximum value in the data range, None if invalid"
        },
        "num_buckets": {
          "type": "integer",
          "title": "Num Buckets",
          "description": "Number of buckets in this histogram"
        }
      },
      "type": "object",
      "required": [
        "counts",
        "bins",
        "bin_centers",
        "range_min",
        "range_max",
        "num_buckets"
      ],
      "title": "HistogramData",
      "description": "Histogram data for a single node at a specific time period."
    },
    "NodeStatistics": {
      "properties": {
        "percentiles": {
          "additionalProperties": {
            "type": "number"
          },
          "type": "object",
          "title": "Percentiles",
          "description": "Percentile bands keyed by label. neumann supplies 5: 10th, 25th, 50th, 75th, 90th."
        },
        "basic_stats": {
          "additionalProperties": {
            "type": "number"
          },
          "type": "object",
          "title": "Basic Stats",
          "description": "Basic statistics: min, max, mean, std"
        },
        "histogram": {
          "anyOf": [
            {
              "$ref": "#/$defs/HistogramConfigurations"
            },
            {
              "type": "null"
            }
          ],
          "description": "Multiple histogram configurations for different visualization needs"
        }
      },
      "type": "object",
      "required": [
        "percentiles",
        "basic_stats"
      ],
      "title": "NodeStatistics",
      "description": "Statistics for a single node at a specific time period."
    },
    "ScenarioAnalysis": {
      "properties": {
        "best_case": {
          "items": {
            "$ref": "#/$defs/TimePeriodData"
          },
          "type": "array",
          "title": "Best Case",
          "description": "Best case scenario results organized by time period"
        },
        "median_case": {
          "items": {
            "$ref": "#/$defs/TimePeriodData"
          },
          "type": "array",
          "title": "Median Case",
          "description": "Median case scenario results organized by time period"
        },
        "worst_case": {
          "items": {
            "$ref": "#/$defs/TimePeriodData"
          },
          "type": "array",
          "title": "Worst Case",
          "description": "Worst case scenario results organized by time period"
        }
      },
      "type": "object",
      "required": [
        "best_case",
        "median_case",
        "worst_case"
      ],
      "title": "ScenarioAnalysis",
      "description": "Best, median, and worst case scenario analysis."
    },
    "TimePeriodData": {
      "properties": {
        "time_period": {
          "type": "integer",
          "title": "Time Period",
          "description": "Time period index"
        },
        "nodes": {
          "additionalProperties": {
            "anyOf": [
              {
                "$ref": "#/$defs/NodeStatistics"
              },
              {
                "type": "number"
              }
            ]
          },
          "type": "object",
          "title": "Nodes",
          "description": "Statistics for each node at this time period (NodeStatistics for summary data, float for scenario analysis)"
        },
        "edges": {
          "additionalProperties": {
            "anyOf": [
              {
                "$ref": "#/$defs/NodeStatistics"
              },
              {
                "type": "number"
              }
            ]
          },
          "type": "object",
          "title": "Edges",
          "description": "Statistics for each edge at this time period (NodeStatistics for summary data, float for scenario analysis)"
        }
      },
      "type": "object",
      "required": [
        "time_period",
        "nodes",
        "edges"
      ],
      "title": "TimePeriodData",
      "description": "Data for a single time period, organized by nodes and edges."
    }
  }
}