{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/krobar-ai/json-schema/krobar-ai-graph-create-with-project-schema.json",
  "title": "GraphCreateWithProject",
  "description": "Schema for creating a new graph directly with project specification.\n\nNote: project_id can be provided via query parameter for permission validation,\nor in the request body for backward compatibility. Query parameter takes precedence.",
  "x-generated": "2026-11-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/krobar-ai-openapi.json#/components/schemas/GraphCreateWithProject",
  "properties": {
    "name": {
      "type": "string",
      "title": "Name",
      "description": "Name of the graph"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Description of the graph"
    },
    "nodes": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Nodes",
      "description": "Nodes in the graph. For root nodes, you may specify 'interval' and 'delay'."
    },
    "edges": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Edges",
      "description": "Edges in the graph"
    },
    "graph_metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Graph Metadata",
      "description": "Additional metadata for the graph",
      "default": {}
    },
    "illustrations": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Illustrations",
      "description": "Mapping of illustration keys to image IDs or URLs"
    },
    "canvas_view_filters": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "boolean"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Canvas View Filters",
      "description": "Filters for the canvas view"
    },
    "time_period_unit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Time Period Unit",
      "description": "Unit of time for simulation periods (e.g., 'month')",
      "default": "month"
    },
    "estimation_percentile": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Estimation Percentile",
      "description": "Percentile used for estimation calculations",
      "default": 0.9
    },
    "simulation_trials": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulation Trials",
      "description": "Number of simulation trials to run",
      "default": 1000
    },
    "simulation_time_periods": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulation Time Periods",
      "description": "Number of time periods to simulate",
      "default": 12
    },
    "simulation_goal_node": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulation Goal Node",
      "description": "Node ID used as the simulation goal"
    },
    "simulation_goal_value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulation Goal Value",
      "description": "Value to reach for the goal node"
    },
    "simulation_goal_direction": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "MAXIMIZE",
            "MINIMIZE"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulation Goal Direction",
      "description": "Direction for the simulation goal ('MAXIMIZE' or 'MINIMIZE')"
    },
    "simulation_goal_time_period": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Simulation Goal Time Period",
      "description": "Time period to use for goal calculation (1-based index)"
    },
    "starting_time_period": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Starting Time Period",
      "description": "Actual start date/time for the simulation (e.g., 2025-08-01T00:00:00)"
    },
    "display_timezone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Display Timezone",
      "description": "IANA timezone identifier for displaying the start time (e.g., 'America/New_York', 'Europe/London')"
    },
    "parameter_display_mode": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Parameter Display Mode",
      "description": "How parameters are displayed in the UI",
      "default": "estimate"
    },
    "canvas_view": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Canvas View",
      "description": "Current view mode of the canvas",
      "default": "journey"
    },
    "illustration_style": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Illustration Style",
      "description": "Style of illustrations",
      "default": "stick"
    },
    "journey_columns": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Journey Columns",
      "description": "Number of journey columns for the graph"
    },
    "tags": {
      "anyOf": [
        {
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                }
              ]
            },
            "type": "array"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tags",
      "description": "Tags for the graph as a list of [string, boolean] pairs, e.g. [['journey', true], ['costs', true]]"
    },
    "project_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Id",
      "description": "ID of the project this graph belongs to"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "nodes",
    "edges"
  ]
}