{
    "general": {
      "name": {
        "default": "Reactor",
        "rules": {
          "type": "string",
          "description": "A human-readable name for this reactor."
        }
      },
      "id": {
        "default": null,
        "rules": {
          "type": "string",
          "nullable": true,
          "description": "Unique identifier for this reactor node."
        }
      },
      "unit": {
        "default": null,
        "rules": {
          "type": "string",
          "nullable": true,
          "description": "Default measurement unit."
        }
      },
      "logging": {
        "logLevel": {
          "default": "info",
          "rules": {
            "type": "enum",
            "values": [
              { "value": "debug", "description": "Verbose diagnostic messages." },
              { "value": "info", "description": "General informational messages." },
              { "value": "warn", "description": "Warning messages." },
              { "value": "error", "description": "Error level messages only." }
            ]
          }
        },
        "enabled": {
          "default": true,
          "rules": {
            "type": "boolean",
            "description": "Enable or disable logging."
          }
        }
      }
    },
    "functionality": {
      "softwareType": {
        "default": "reactor",
        "rules": {
          "type": "string",
          "description": "Software type identifier for parent-child registration."
        }
      },
      "role": {
        "default": "Biological reactor for wastewater treatment",
        "rules": {
          "type": "string",
          "description": "Describes the functional role of this node."
        }
      },
      "positionVsParent": {
        "default": "atEquipment",
        "rules": {
          "type": "enum",
          "values": [
            { "value": "upstream", "description": "Upstream of parent equipment." },
            { "value": "atEquipment", "description": "At equipment level." },
            { "value": "downstream", "description": "Downstream of parent equipment." }
          ]
        }
      }
    },
    "reactor": {
      "reactor_type": {
        "default": "CSTR",
        "rules": {
          "type": "enum",
          "values": [
            { "value": "CSTR", "description": "Continuous Stirred Tank Reactor - fully mixed." },
            { "value": "PFR", "description": "Plug Flow Reactor - spatial gradient along length." }
          ]
        }
      },
      "volume": {
        "default": 1000,
        "rules": {
          "type": "number",
          "min": 0,
          "unit": "m3",
          "description": "Reactor volume in cubic meters."
        }
      },
      "length": {
        "default": 10,
        "rules": {
          "type": "number",
          "min": 0,
          "unit": "m",
          "description": "Reactor length (relevant for PFR spatial discretization)."
        }
      },
      "resolution_L": {
        "default": 10,
        "rules": {
          "type": "integer",
          "min": 1,
          "description": "Number of spatial segments for PFR discretization."
        }
      },
      "alpha": {
        "default": 0.5,
        "rules": {
          "type": "number",
          "min": 0,
          "max": 1,
          "description": "Dispersion coefficient alpha (0 = plug flow, 1 = fully mixed)."
        }
      },
      "n_inlets": {
        "default": 1,
        "rules": {
          "type": "integer",
          "min": 1,
          "description": "Number of inlet points along the reactor."
        }
      },
      "kla": {
        "default": 0,
        "rules": {
          "type": "number",
          "min": 0,
          "unit": "1/h",
          "description": "Oxygen mass transfer coefficient (KLa)."
        }
      },
      "timeStep": {
        "default": 1,
        "rules": {
          "type": "number",
          "min": 0.001,
          "unit": "s",
          "description": "Integration time step in seconds. The kinetics engine converts to days internally (timeStep / 86400) before each ASM Euler step; the HTML editor labels this field [s] and tests assume seconds. Do not change the unit without updating baseEngine.js line 40 in the reactor submodule."
        }
      }
    },
    "initialState": {
      "S_O": {
        "default": 0,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial dissolved oxygen concentration." }
      },
      "S_I": {
        "default": 30,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial inert soluble COD." }
      },
      "S_S": {
        "default": 70,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial readily biodegradable substrate." }
      },
      "S_NH": {
        "default": 25,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial ammonium nitrogen." }
      },
      "S_N2": {
        "default": 0,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial dinitrogen (N2)." }
      },
      "S_NO": {
        "default": 0,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial nitrate and nitrite nitrogen." }
      },
      "S_HCO": {
        "default": 5,
        "rules": { "type": "number", "unit": "mmol/L", "description": "Initial alkalinity (bicarbonate)." }
      },
      "X_I": {
        "default": 1000,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial inert particulate COD." }
      },
      "X_S": {
        "default": 100,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial slowly biodegradable substrate." }
      },
      "X_H": {
        "default": 2000,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial heterotrophic biomass." }
      },
      "X_STO": {
        "default": 0,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial stored COD in biomass." }
      },
      "X_A": {
        "default": 200,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial autotrophic biomass." }
      },
      "X_TS": {
        "default": 3500,
        "rules": { "type": "number", "unit": "mg/L", "description": "Initial total suspended solids." }
      }
    }
  }
