{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/untangle-bio/json-schema/untangle-bio-goal-seek-body-schema.json",
  "title": "GoalSeekBody",
  "description": "Same feed and steps the simulation posted, goal-sought against a cost target.\n\nStage 1 searches the operating (and optionally equipment) parameters for settings\nthat reach `target_cogs_per_kg`, stopping early when they do. If they cannot, stage 2\nopens the model-role calibrations and the feed titre one at a time and reports the\nvalue of each at which the target becomes reachable - R&D requirements, not settings.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/untangle-bio-openapi.json#/components/schemas/GoalSeekBody",
  "additionalProperties": false,
  "properties": {
    "annual_operating_hours": {
      "default": 8000,
      "maximum": 8760.0,
      "minimum": 1.0,
      "title": "Annual Operating Hours",
      "type": "integer"
    },
    "co_product_prices_usd_per_kg": {
      "anyOf": [
        {
          "additionalProperties": {
            "maximum": 10000000.0,
            "minimum": 0.0,
            "type": "number"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "description": "Stated selling price per declared co-product, USD/kg.",
      "title": "Co Product Prices Usd Per Kg"
    },
    "co_products": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "description": "Target products sold as co-products.",
      "title": "Co Products"
    },
    "cooling_water_price_usd_per_m3": {
      "default": 0.0764,
      "exclusiveMinimum": 0.0,
      "maximum": 10.0,
      "title": "Cooling Water Price Usd Per M3",
      "type": "number"
    },
    "electricity_price_usd_per_kWh": {
      "default": 0.1,
      "exclusiveMinimum": 0.0,
      "maximum": 2.0,
      "title": "Electricity Price Usd Per Kwh",
      "type": "number"
    },
    "facility_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Facility Type"
    },
    "feed_basis": {
      "default": "auto",
      "enum": [
        "auto",
        "internal_broth",
        "purchased"
      ],
      "title": "Feed Basis",
      "type": "string"
    },
    "feeds": {
      "additionalProperties": {
        "additionalProperties": true,
        "type": "object"
      },
      "default": {},
      "title": "Feeds",
      "type": "object"
    },
    "labor_profile": {
      "default": "us_food",
      "title": "Labor Profile",
      "type": "string"
    },
    "max_evaluations": {
      "default": 100,
      "maximum": 20000.0,
      "minimum": 1.0,
      "title": "Max Evaluations",
      "type": "integer"
    },
    "max_multiplier": {
      "default": 10.0,
      "exclusiveMinimum": 1.0,
      "maximum": 100.0,
      "title": "Max Multiplier",
      "type": "number"
    },
    "min_annual_product_kg": {
      "anyOf": [
        {
          "exclusiveMinimum": 0.0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Min Annual Product Kg"
    },
    "min_purity": {
      "default": 0.0,
      "maximum": 1.0,
      "minimum": 0.0,
      "title": "Min Purity",
      "type": "number"
    },
    "min_yield": {
      "default": 0.0,
      "maximum": 1.0,
      "minimum": 0.0,
      "title": "Min Yield",
      "type": "number"
    },
    "optimize_feed_flow": {
      "default": true,
      "title": "Optimize Feed Flow",
      "type": "boolean"
    },
    "product_identity_requested_targets": {
      "items": {
        "type": "string"
      },
      "title": "Product Identity Requested Targets",
      "type": "array"
    },
    "product_identity_warnings": {
      "items": {
        "type": "string"
      },
      "title": "Product Identity Warnings",
      "type": "array"
    },
    "product_selling_price_source": {
      "default": "default",
      "enum": [
        "default",
        "user_supplied"
      ],
      "title": "Product Selling Price Source",
      "type": "string"
    },
    "product_selling_price_usd_per_kg": {
      "default": 100.0,
      "maximum": 10000000.0,
      "minimum": 0.0,
      "title": "Product Selling Price Usd Per Kg",
      "type": "number"
    },
    "recycles": {
      "default": [],
      "items": {
        "$ref": "#/$defs/RecycleSpec"
      },
      "title": "Recycles",
      "type": "array"
    },
    "roles": {
      "items": {
        "type": "string"
      },
      "title": "Roles",
      "type": "array"
    },
    "seed": {
      "default": 1,
      "maximum": 2147483647.0,
      "minimum": 0.0,
      "title": "Seed",
      "type": "integer"
    },
    "skip_steps": {
      "items": {
        "type": "integer"
      },
      "title": "Skip Steps",
      "type": "array"
    },
    "steam_price_usd_per_GJ": {
      "default": 18.0,
      "exclusiveMinimum": 0.0,
      "maximum": 200.0,
      "title": "Steam Price Usd Per Gj",
      "type": "number"
    },
    "steps": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "title": "Steps",
      "type": "array"
    },
    "stream": {
      "additionalProperties": true,
      "title": "Stream",
      "type": "object"
    },
    "stream_closure_warnings": {
      "items": {
        "type": "string"
      },
      "title": "Stream Closure Warnings",
      "type": "array"
    },
    "target_cogs_per_kg": {
      "exclusiveMinimum": 0.0,
      "title": "Target Cogs Per Kg",
      "type": "number"
    },
    "target_products": {
      "items": {
        "type": "string"
      },
      "title": "Target Products",
      "type": "array"
    },
    "target_provenance": {
      "anyOf": [
        {
          "additionalProperties": {
            "items": {
              "$ref": "#/$defs/TargetProvenanceRoot"
            },
            "type": "array"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Provenance"
    },
    "terminal_streams": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/TerminalStream"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Terminal Streams"
    },
    "wastewater_scope": {
      "default": "included",
      "enum": [
        "included",
        "excluded_osbl"
      ],
      "title": "Wastewater Scope",
      "type": "string"
    }
  },
  "required": [
    "stream",
    "steps",
    "target_products",
    "target_cogs_per_kg"
  ],
  "type": "object",
  "$defs": {
    "RecycleSpec": {
      "additionalProperties": false,
      "description": "One tear-stream recycle. 0-indexed step numbers; a recycle runs BACKWARDS, so\nto_step <= from_step.\n\nTyped because `recycles: List[dict]` let a malformed loop through the contract and\ninto the solver, which then dropped it with a warning: to_step=9 on a 4-step route\nreturned HTTP 200, n_recycles 0, method \"single pass (no recycle)\" - the user had\ndrawn a loop and been handed a single-pass answer that looked like an answer. The\nwarning backstop in thorough_flowsheet._valid_recycles stays (it also catches\nfrom_step past the end of the route, which needs the route length to judge), but a\nbody that cannot possibly be a valid loop is now a 422 at the door.",
      "properties": {
        "fraction": {
          "exclusiveMinimum": 0.0,
          "maximum": 0.99,
          "title": "Fraction",
          "type": "number"
        },
        "from_step": {
          "minimum": 0.0,
          "title": "From Step",
          "type": "integer"
        },
        "outlet": {
          "default": "light",
          "enum": [
            "light",
            "heavy"
          ],
          "title": "Outlet",
          "type": "string"
        },
        "to_step": {
          "minimum": 0.0,
          "title": "To Step",
          "type": "integer"
        }
      },
      "required": [
        "from_step",
        "to_step",
        "fraction"
      ],
      "title": "RecycleSpec",
      "type": "object"
    },
    "TargetProvenanceRoot": {
      "description": "A real additive source for target mass: external feed or producer step.",
      "properties": {
        "feed_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Feed Id"
        },
        "kind": {
          "enum": [
            "feed",
            "producer"
          ],
          "title": "Kind",
          "type": "string"
        },
        "step_index": {
          "anyOf": [
            {
              "minimum": 0.0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Step Index"
        }
      },
      "required": [
        "kind"
      ],
      "title": "TargetProvenanceRoot",
      "type": "object"
    },
    "TerminalStream": {
      "description": "One terminal edge claiming a fraction of a physical operation outlet.",
      "properties": {
        "fraction": {
          "exclusiveMinimum": 0.0,
          "maximum": 1.0,
          "title": "Fraction",
          "type": "number"
        },
        "output_index": {
          "minimum": 0.0,
          "title": "Output Index",
          "type": "integer"
        },
        "port_id": {
          "minLength": 1,
          "title": "Port Id",
          "type": "string"
        },
        "sink": {
          "enum": [
            "product",
            "waste",
            "vent"
          ],
          "title": "Sink",
          "type": "string"
        },
        "step_index": {
          "minimum": 0.0,
          "title": "Step Index",
          "type": "integer"
        },
        "target_products": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Target Products",
          "type": "array"
        },
        "terminal_id": {
          "minLength": 1,
          "title": "Terminal Id",
          "type": "string"
        }
      },
      "required": [
        "terminal_id",
        "step_index",
        "port_id",
        "output_index",
        "sink",
        "fraction"
      ],
      "title": "TerminalStream",
      "type": "object"
    }
  }
}