{
  "$defs": {
    "ArtifactRef": {
      "additionalProperties": false,
      "description": "A file the model needs (an FMU, a NetLogo model), stored by its digest.",
      "properties": {
        "digest": {
          "pattern": "^sha256:[0-9a-f]{64}$",
          "title": "Digest",
          "type": "string"
        },
        "filename": {
          "description": "Name to give the file when an engine needs it",
          "minLength": 1,
          "title": "Filename",
          "type": "string"
        }
      },
      "required": [
        "digest",
        "filename"
      ],
      "title": "ArtifactRef",
      "type": "object"
    },
    "BuiltFrom": {
      "additionalProperties": false,
      "description": "The Modelica source an FMU was compiled from, by `sala compile`.",
      "properties": {
        "compiler": {
          "description": "The compiler's version, and the standard library's",
          "minLength": 1,
          "title": "Compiler",
          "type": "string"
        },
        "fmu_type": {
          "default": "cs",
          "enum": [
            "cs",
            "me"
          ],
          "title": "Fmu Type",
          "type": "string"
        },
        "model": {
          "description": "The Modelica class compiled",
          "minLength": 1,
          "title": "Model",
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/ArtifactRef",
          "description": "The .mo file, or the package directory as a zip"
        }
      },
      "required": [
        "source",
        "model",
        "compiler"
      ],
      "title": "BuiltFrom",
      "type": "object"
    },
    "Connection": {
      "additionalProperties": false,
      "properties": {
        "from": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "From",
          "type": "string"
        },
        "to": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "To",
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ],
      "title": "Connection",
      "type": "object"
    },
    "Constant": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "constant",
          "title": "Kind",
          "type": "string"
        },
        "value": {
          "minimum": 0,
          "title": "Value",
          "type": "number"
        }
      },
      "required": [
        "kind",
        "value"
      ],
      "title": "Constant",
      "type": "object"
    },
    "Counterpart": {
      "additionalProperties": false,
      "description": "Where the qualitative model meets a numerical one: which output measures\nwhich quantity or mode, and the numbers behind the landmarks.",
      "properties": {
        "directions": {
          "default": true,
          "description": "Also compare whether each quantity rises, holds or falls",
          "title": "Directions",
          "type": "boolean"
        },
        "model": {
          "pattern": "^sha256:[0-9a-f]{64}$",
          "title": "Model",
          "type": "string"
        },
        "modes": {
          "default": {},
          "patternProperties": {
            "^[A-Za-z][A-Za-z0-9_-]{0,63}$": {
              "$ref": "#/$defs/CounterpartMode"
            }
          },
          "title": "Modes",
          "type": "object"
        },
        "other_models": {
          "default": [],
          "description": "Other models whose runs carry the same outputs, e.g. the same plant driven by its controller's code",
          "items": {
            "pattern": "^sha256:[0-9a-f]{64}$",
            "type": "string"
          },
          "title": "Other Models",
          "type": "array"
        },
        "quantities": {
          "minProperties": 1,
          "patternProperties": {
            "^[A-Za-z][A-Za-z0-9_-]{0,63}$": {
              "$ref": "#/$defs/CounterpartQuantity"
            }
          },
          "title": "Quantities",
          "type": "object"
        }
      },
      "required": [
        "model",
        "quantities"
      ],
      "title": "Counterpart",
      "type": "object"
    },
    "CounterpartMode": {
      "additionalProperties": false,
      "properties": {
        "output": {
          "minLength": 1,
          "title": "Output",
          "type": "string"
        },
        "values": {
          "description": "Mode value for each output value",
          "patternProperties": {
            "^[A-Za-z][A-Za-z0-9_-]{0,63}$": {
              "type": "number"
            }
          },
          "title": "Values",
          "type": "object"
        }
      },
      "required": [
        "output",
        "values"
      ],
      "title": "CounterpartMode",
      "type": "object"
    },
    "CounterpartQuantity": {
      "additionalProperties": false,
      "properties": {
        "landmarks": {
          "patternProperties": {
            "^[A-Za-z][A-Za-z0-9_-]{0,63}$": {
              "type": "number"
            }
          },
          "title": "Landmarks",
          "type": "object"
        },
        "output": {
          "description": "Series of the counterpart's result",
          "minLength": 1,
          "title": "Output",
          "type": "string"
        },
        "smoothing": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Compare the moving average over this window (in the counterpart's time unit) rather than each sample: a stochastic run fluctuates around the trend a qualitative model states",
          "title": "Smoothing"
        },
        "tolerance": {
          "default": 0.0,
          "description": "A value this close to a landmark is at it",
          "minimum": 0,
          "title": "Tolerance",
          "type": "number"
        }
      },
      "required": [
        "output",
        "landmarks"
      ],
      "title": "CounterpartQuantity",
      "type": "object"
    },
    "CoupledComponent": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Id",
          "type": "string"
        },
        "model": {
          "description": "An FMU or target model, stored first",
          "pattern": "^sha256:[0-9a-f]{64}$",
          "title": "Model",
          "type": "string"
        }
      },
      "required": [
        "id",
        "model"
      ],
      "title": "CoupledComponent",
      "type": "object"
    },
    "CoupledModel": {
      "additionalProperties": false,
      "description": "Two or more FMU models run together: one's outputs drive another's inputs,\nexchanged at a fixed communication step.",
      "properties": {
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "components": {
          "items": {
            "$ref": "#/$defs/CoupledComponent"
          },
          "minItems": 2,
          "title": "Components",
          "type": "array"
        },
        "connections": {
          "items": {
            "$ref": "#/$defs/Coupling"
          },
          "minItems": 1,
          "title": "Connections",
          "type": "array"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "kind": {
          "const": "coupled",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "outputs": {
          "items": {
            "$ref": "#/$defs/CoupledOutput"
          },
          "minItems": 1,
          "title": "Outputs",
          "type": "array"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "step": {
          "description": "Communication step: how often values cross the connections",
          "exclusiveMinimum": 0,
          "title": "Step",
          "type": "number"
        },
        "time_unit": {
          "default": "s",
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "components",
        "connections",
        "step",
        "outputs"
      ],
      "title": "CoupledModel",
      "type": "object"
    },
    "CoupledOutput": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "description": "The series name in the result",
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "source": {
          "description": "component.output",
          "pattern": "^[A-Za-z][A-Za-z0-9_-]*\\.\\S+$",
          "title": "Source",
          "type": "string"
        }
      },
      "required": [
        "name",
        "source"
      ],
      "title": "CoupledOutput",
      "type": "object"
    },
    "Coupling": {
      "additionalProperties": false,
      "properties": {
        "from": {
          "description": "component.output",
          "pattern": "^[A-Za-z][A-Za-z0-9_-]*\\.\\S+$",
          "title": "From",
          "type": "string"
        },
        "to": {
          "description": "component.input",
          "pattern": "^[A-Za-z][A-Za-z0-9_-]*\\.\\S+$",
          "title": "To",
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ],
      "title": "Coupling",
      "type": "object"
    },
    "Dominance": {
      "additionalProperties": false,
      "description": "An assumption: when both are active, `stronger` outweighs `weaker`.",
      "properties": {
        "assumption": {
          "description": "Why it holds; a reviewer must be able to check it",
          "minLength": 1,
          "title": "Assumption",
          "type": "string"
        },
        "stronger": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Stronger",
          "type": "string"
        },
        "weaker": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Weaker",
          "type": "string"
        },
        "when": {
          "default": [],
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/QuantityCondition"
              },
              {
                "$ref": "#/$defs/ModeCondition"
              }
            ]
          },
          "title": "When",
          "type": "array"
        }
      },
      "required": [
        "stronger",
        "weaker",
        "assumption"
      ],
      "title": "Dominance",
      "type": "object"
    },
    "EngineModel": {
      "additionalProperties": false,
      "description": "Any engine that speaks mokili-step/2: a simulator, a script, a solver, or\ncontrol code, in its own process. It describes itself when it starts, and\nthe run checks that description against this record.",
      "properties": {
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "determinism": {
          "description": "deterministic: same inputs, same outputs; seeded: the same for the same seed; external: depends on something Mokili cannot rerun",
          "enum": [
            "deterministic",
            "seeded",
            "external"
          ],
          "title": "Determinism",
          "type": "string"
        },
        "inputs": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "title": "Inputs",
          "type": "array"
        },
        "kind": {
          "const": "engine",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "outputs": {
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "minItems": 1,
          "title": "Outputs",
          "type": "array"
        },
        "parameters": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "title": "Parameters",
          "type": "array"
        },
        "program": {
          "anyOf": [
            {
              "$ref": "#/$defs/ArtifactRef"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The program: a Python script or an executable"
        },
        "protocol": {
          "const": "mokili-step/2",
          "default": "mokili-step/2",
          "title": "Protocol",
          "type": "string"
        },
        "runtime": {
          "$ref": "#/$defs/EngineRuntime"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "time_unit": {
          "default": "s",
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "runtime",
        "determinism",
        "outputs"
      ],
      "title": "EngineModel",
      "type": "object"
    },
    "EngineRuntime": {
      "additionalProperties": false,
      "description": "Where an engine's program runs. `python` and `native`: on this machine,\nas a process; `emulated-processor`: under QEMU; `bench`: through the bridge\nthe operator configured for that name (never a command in the record).",
      "properties": {
        "architecture": {
          "default": "",
          "description": "Emulated processors: e.g. aarch64",
          "title": "Architecture",
          "type": "string"
        },
        "bench": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bench"
        },
        "kind": {
          "enum": [
            "python",
            "native",
            "emulated-processor",
            "bench"
          ],
          "title": "Kind",
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "title": "EngineRuntime",
      "type": "object"
    },
    "EquationBalance": {
      "additionalProperties": false,
      "description": "A conservation law the run keeps: the stock changes at the rate, nothing else.",
      "properties": {
        "name": {
          "description": "What is conserved, e.g. water in the tank",
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "rate": {
          "description": "What makes it change, per second, e.g. inflow - outflow",
          "minLength": 1,
          "title": "Rate",
          "type": "string"
        },
        "stock": {
          "description": "An expression of the model's quantities, e.g. area * level",
          "minLength": 1,
          "title": "Stock",
          "type": "string"
        },
        "tolerance": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Drift allowed, in the stock's unit; by default what the tolerances allow",
          "title": "Tolerance"
        }
      },
      "required": [
        "name",
        "stock",
        "rate"
      ],
      "title": "EquationBalance",
      "type": "object"
    },
    "EquationEvent": {
      "additionalProperties": false,
      "description": "When a condition becomes true, set states or discrete quantities.",
      "properties": {
        "do": {
          "description": "Actions, e.g. pump := 0; each reads the values before the event",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "title": "Do",
          "type": "array"
        },
        "initially": {
          "default": false,
          "description": "Also at the start, when the condition already holds there: the event keeps a rule true (a hysteresis' state) rather than marking a change",
          "title": "Initially",
          "type": "boolean"
        },
        "when": {
          "description": "A comparison, e.g. h >= 1.5",
          "minLength": 1,
          "title": "When",
          "type": "string"
        }
      },
      "required": [
        "when",
        "do"
      ],
      "title": "EquationEvent",
      "type": "object"
    },
    "EquationQuantity": {
      "additionalProperties": false,
      "description": "A quantity of an equations model: what it is, its unit, its value.",
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "fixed": {
          "default": false,
          "description": "A state's or algebraic quantity's value is required at the start, not a first guess: the states that are not fixed are moved to meet it, and the constraints that tie them together",
          "title": "Fixed",
          "type": "boolean"
        },
        "free": {
          "default": false,
          "description": "A parameter computed at the start by the initial equations that read it, its value the first guess: a waveform's time constants found from its rise and decay times",
          "title": "Free",
          "type": "boolean"
        },
        "name": {
          "maxLength": 128,
          "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\[[0-9]+(,[0-9]+)*\\])?(\\.[A-Za-z_][A-Za-z0-9_]*(\\[[0-9]+(,[0-9]+)*\\])?)*$",
          "title": "Name",
          "type": "string"
        },
        "prefer": {
          "default": false,
          "description": "A state or algebraic quantity an event's reinit( ) leaves alone, the other states moving instead: Modelica's stateSelect prefer or always \u2014 a spring's stretch rate, when the mass it holds is stopped",
          "title": "Prefer",
          "type": "boolean"
        },
        "role": {
          "description": "state: changes through der( ); algebraic: given by an equation; parameter: fixed for a run; input: set from outside (a scenario, or another model of a coupled model); discrete: changes only in events",
          "enum": [
            "state",
            "algebraic",
            "parameter",
            "input",
            "discrete"
          ],
          "title": "Role",
          "type": "string"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Checked with its scale: L/min and m3/s are never added. Left out, the quantity is not checked",
          "title": "Unit"
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A state's or discrete quantity's initial value; a parameter's or input's value",
          "title": "Value"
        }
      },
      "required": [
        "name",
        "role"
      ],
      "title": "EquationQuantity",
      "type": "object"
    },
    "EquationsModel": {
      "additionalProperties": false,
      "description": "A lumped system written as equations, run by Mokili's own engine.",
      "properties": {
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "balances": {
          "default": [],
          "description": "Checked at every step: a run that creates or loses a stock stops with balance_broken",
          "items": {
            "$ref": "#/$defs/EquationBalance"
          },
          "title": "Balances",
          "type": "array"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "discrete_equations": {
          "default": [],
          "description": "`x := expression` for a discrete quantity, computed at the start and at every event until nothing changes, pre(y) being y as the event found it: a friction's mode, a hysteresis",
          "items": {
            "type": "string"
          },
          "title": "Discrete Equations",
          "type": "array"
        },
        "equations": {
          "description": "der(x) = ... for each state, y = ... for each algebraic quantity",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "title": "Equations",
          "type": "array"
        },
        "events": {
          "default": [],
          "items": {
            "$ref": "#/$defs/EquationEvent"
          },
          "title": "Events",
          "type": "array"
        },
        "initial_equations": {
          "default": [],
          "description": "Equations that hold at the start only \u2014 `v = v_ref`, `der(y) = 0` \u2014 met by moving the states that are not fixed",
          "items": {
            "type": "string"
          },
          "title": "Initial Equations",
          "type": "array"
        },
        "kind": {
          "const": "equations",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "numerics": {
          "anyOf": [
            {
              "$ref": "#/$defs/Numerics"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "quantities": {
          "items": {
            "$ref": "#/$defs/EquationQuantity"
          },
          "minItems": 1,
          "title": "Quantities",
          "type": "array"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "translated_from": {
          "anyOf": [
            {
              "$ref": "#/$defs/TranslatedFrom"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "quantities",
        "equations"
      ],
      "title": "EquationsModel",
      "type": "object"
    },
    "Exponential": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "exponential",
          "title": "Kind",
          "type": "string"
        },
        "mean": {
          "exclusiveMinimum": 0,
          "title": "Mean",
          "type": "number"
        }
      },
      "required": [
        "kind",
        "mean"
      ],
      "title": "Exponential",
      "type": "object"
    },
    "Fault": {
      "additionalProperties": false,
      "description": "Something that can happen at any time, not decided by the controller.",
      "properties": {
        "from": {
          "items": {
            "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
            "type": "string"
          },
          "minItems": 1,
          "title": "From",
          "type": "array"
        },
        "mode": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Mode",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "to": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "To",
          "type": "string"
        }
      },
      "required": [
        "name",
        "mode",
        "from",
        "to"
      ],
      "title": "Fault",
      "type": "object"
    },
    "FlowModel": {
      "additionalProperties": false,
      "description": "A flow of work: components, how work moves between them, and the\nassumptions a reader needs to judge the result.",
      "properties": {
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "components": {
          "items": {
            "discriminator": {
              "mapping": {
                "sink": "#/$defs/Sink",
                "source": "#/$defs/Source",
                "station": "#/$defs/Station"
              },
              "propertyName": "kind"
            },
            "oneOf": [
              {
                "$ref": "#/$defs/Source"
              },
              {
                "$ref": "#/$defs/Station"
              },
              {
                "$ref": "#/$defs/Sink"
              }
            ]
          },
          "minItems": 2,
          "title": "Components",
          "type": "array"
        },
        "connections": {
          "items": {
            "$ref": "#/$defs/Connection"
          },
          "title": "Connections",
          "type": "array"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "kind": {
          "const": "flow",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "time_unit": {
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "time_unit",
        "components",
        "connections"
      ],
      "title": "FlowModel",
      "type": "object"
    },
    "FmuModel": {
      "additionalProperties": false,
      "description": "A numerical model compiled as an FMI 2.0 Functional Mock-up Unit.",
      "properties": {
        "artifact": {
          "$ref": "#/$defs/ArtifactRef"
        },
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "built_from": {
          "anyOf": [
            {
              "$ref": "#/$defs/BuiltFrom"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Modelica source the FMU was compiled from; it travels with the model's bundles"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "inputs": {
          "default": [],
          "description": "Inputs another model drives, when this FMU is part of a coupled model",
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "title": "Inputs",
          "type": "array"
        },
        "kind": {
          "const": "fmu",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "outputs": {
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "minItems": 1,
          "title": "Outputs",
          "type": "array"
        },
        "parameters": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "title": "Parameters",
          "type": "array"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "time_unit": {
          "default": "s",
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "artifact",
        "outputs"
      ],
      "title": "FmuModel",
      "type": "object"
    },
    "Hazard": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "when": {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/QuantityCondition"
              },
              {
                "$ref": "#/$defs/ModeCondition"
              }
            ]
          },
          "minItems": 1,
          "title": "When",
          "type": "array"
        }
      },
      "required": [
        "name",
        "when"
      ],
      "title": "Hazard",
      "type": "object"
    },
    "Influence": {
      "additionalProperties": false,
      "description": "Pushes a quantity up (+) or down (-) while all its conditions hold.",
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "quantity": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Quantity",
          "type": "string"
        },
        "sign": {
          "enum": [
            "+",
            "-"
          ],
          "title": "Sign",
          "type": "string"
        },
        "when": {
          "default": [],
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/QuantityCondition"
              },
              {
                "$ref": "#/$defs/ModeCondition"
              }
            ]
          },
          "title": "When",
          "type": "array"
        }
      },
      "required": [
        "name",
        "quantity",
        "sign"
      ],
      "title": "Influence",
      "type": "object"
    },
    "LibraryUsed": {
      "additionalProperties": false,
      "properties": {
        "licence": {
          "anyOf": [
            {
              "$ref": "#/$defs/ArtifactRef"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The library's licence text, stored by its digest: it travels with the model's bundles, as a licence such as BSD asks wherever the library's source, or what is made from it, goes"
        },
        "name": {
          "description": "A Modelica library, e.g. Modelica",
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "version": {
          "default": "",
          "description": "Its version, as its own annotation gives it",
          "title": "Version",
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "title": "LibraryUsed",
      "type": "object"
    },
    "ModeCondition": {
      "additionalProperties": false,
      "description": "`pump in [on, stuck_on]`.",
      "properties": {
        "in": {
          "items": {
            "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
            "type": "string"
          },
          "minItems": 1,
          "title": "In",
          "type": "array"
        },
        "mode": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Mode",
          "type": "string"
        }
      },
      "required": [
        "mode",
        "in"
      ],
      "title": "ModeCondition",
      "type": "object"
    },
    "NetLogoGlobal": {
      "additionalProperties": false,
      "description": "A NetLogo global a scenario may set (a slider, switch, chooser or input).",
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_?!.-]*$",
          "title": "Name",
          "type": "string"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Unit"
        }
      },
      "required": [
        "name"
      ],
      "title": "NetLogoGlobal",
      "type": "object"
    },
    "NetLogoModel": {
      "additionalProperties": false,
      "description": "An agent-based model written in NetLogo (a .nlogox file).",
      "properties": {
        "artifact": {
          "$ref": "#/$defs/ArtifactRef"
        },
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "go": {
          "default": "go",
          "description": "Commands run once per tick",
          "minLength": 1,
          "title": "Go",
          "type": "string"
        },
        "kind": {
          "const": "netlogo",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "outputs": {
          "items": {
            "$ref": "#/$defs/Reporter"
          },
          "minItems": 1,
          "title": "Outputs",
          "type": "array"
        },
        "parameters": {
          "default": [],
          "items": {
            "$ref": "#/$defs/NetLogoGlobal"
          },
          "title": "Parameters",
          "type": "array"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "setup": {
          "default": "setup",
          "description": "Commands run once, after the seed",
          "minLength": 1,
          "title": "Setup",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "time_unit": {
          "default": "tick",
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "artifact",
        "outputs"
      ],
      "title": "NetLogoModel",
      "type": "object"
    },
    "Normal": {
      "additionalProperties": false,
      "description": "Normal distribution; a negative draw is truncated to zero.",
      "properties": {
        "kind": {
          "const": "normal",
          "title": "Kind",
          "type": "string"
        },
        "mean": {
          "title": "Mean",
          "type": "number"
        },
        "std": {
          "exclusiveMinimum": 0,
          "title": "Std",
          "type": "number"
        }
      },
      "required": [
        "kind",
        "mean",
        "std"
      ],
      "title": "Normal",
      "type": "object"
    },
    "Numerics": {
      "additionalProperties": false,
      "description": "How the engine integrates: part of the model, since it shapes the result.",
      "properties": {
        "atol": {
          "default": 1e-10,
          "exclusiveMinimum": 0,
          "title": "Atol",
          "type": "number"
        },
        "method": {
          "default": "auto",
          "enum": [
            "auto",
            "dopri5",
            "radau5",
            "certified"
          ],
          "title": "Method",
          "type": "string"
        },
        "rtol": {
          "default": 1e-08,
          "exclusiveMaximum": 1,
          "exclusiveMinimum": 0,
          "title": "Rtol",
          "type": "number"
        },
        "subdivisions": {
          "default": 1,
          "description": "Guaranteed bounds: parts each uncertain interval is divided into; narrower bounds, more boxes",
          "maximum": 64,
          "minimum": 1,
          "title": "Subdivisions",
          "type": "integer"
        }
      },
      "title": "Numerics",
      "type": "object"
    },
    "QualitativeMode": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "values": {
          "items": {
            "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
            "type": "string"
          },
          "minItems": 2,
          "title": "Values",
          "type": "array"
        }
      },
      "required": [
        "name",
        "values"
      ],
      "title": "QualitativeMode",
      "type": "object"
    },
    "QualitativeModel": {
      "additionalProperties": false,
      "description": "What can happen in a system, stated before it is quantified.",
      "properties": {
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "counterpart": {
          "anyOf": [
            {
              "$ref": "#/$defs/Counterpart"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "dominances": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Dominance"
          },
          "title": "Dominances",
          "type": "array"
        },
        "faults": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Fault"
          },
          "title": "Faults",
          "type": "array"
        },
        "hazards": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Hazard"
          },
          "title": "Hazards",
          "type": "array"
        },
        "influences": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Influence"
          },
          "title": "Influences",
          "type": "array"
        },
        "kind": {
          "const": "qualitative",
          "title": "Kind",
          "type": "string"
        },
        "modes": {
          "default": [],
          "items": {
            "$ref": "#/$defs/QualitativeMode"
          },
          "title": "Modes",
          "type": "array"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "quantities": {
          "items": {
            "$ref": "#/$defs/QualitativeQuantity"
          },
          "minItems": 1,
          "title": "Quantities",
          "type": "array"
        },
        "rules": {
          "default": [],
          "items": {
            "$ref": "#/$defs/Rule"
          },
          "title": "Rules",
          "type": "array"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "time_unit": {
          "default": "transition",
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "quantities"
      ],
      "title": "QualitativeModel",
      "type": "object"
    },
    "QualitativeQuantity": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "landmarks": {
          "description": "Ordered from lowest to highest, e.g. empty, low, high, full",
          "items": {
            "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
            "type": "string"
          },
          "minItems": 2,
          "title": "Landmarks",
          "type": "array"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Unit"
        }
      },
      "required": [
        "name",
        "landmarks"
      ],
      "title": "QualitativeQuantity",
      "type": "object"
    },
    "Quantity": {
      "additionalProperties": false,
      "description": "A parameter or output of an FMU: the variable's name in the FMU, and its unit.",
      "properties": {
        "code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Outputs of code: the entity that writes it, as Muundo names it in the model's source report",
          "title": "Code"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Unit"
        }
      },
      "required": [
        "name"
      ],
      "title": "Quantity",
      "type": "object"
    },
    "QuantityCondition": {
      "additionalProperties": false,
      "description": "`level <= low`: compares a quantity with one of its landmarks.",
      "properties": {
        "landmark": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Landmark",
          "type": "string"
        },
        "op": {
          "enum": [
            "<",
            "<=",
            "==",
            ">=",
            ">"
          ],
          "title": "Op",
          "type": "string"
        },
        "quantity": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Quantity",
          "type": "string"
        }
      },
      "required": [
        "quantity",
        "op",
        "landmark"
      ],
      "title": "QuantityCondition",
      "type": "object"
    },
    "Reporter": {
      "additionalProperties": false,
      "description": "A NetLogo output: a name for the series, and the reporter that computes it.",
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "reporter": {
          "description": "NetLogo expression, e.g. count sheep",
          "minLength": 1,
          "title": "Reporter",
          "type": "string"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Unit"
        }
      },
      "required": [
        "name",
        "reporter"
      ],
      "title": "Reporter",
      "type": "object"
    },
    "Rule": {
      "additionalProperties": false,
      "description": "A controller decision: the mode switches as soon as the conditions hold.",
      "properties": {
        "mode": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Mode",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Name",
          "type": "string"
        },
        "to": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "To",
          "type": "string"
        },
        "when": {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/QuantityCondition"
              },
              {
                "$ref": "#/$defs/ModeCondition"
              }
            ]
          },
          "minItems": 1,
          "title": "When",
          "type": "array"
        }
      },
      "required": [
        "name",
        "mode",
        "to",
        "when"
      ],
      "title": "Rule",
      "type": "object"
    },
    "Sink": {
      "additionalProperties": false,
      "description": "Where finished work leaves the system.",
      "properties": {
        "id": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Id",
          "type": "string"
        },
        "kind": {
          "const": "sink",
          "title": "Kind",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "id"
      ],
      "title": "Sink",
      "type": "object"
    },
    "Source": {
      "additionalProperties": false,
      "description": "Where work enters the system.",
      "properties": {
        "id": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Id",
          "type": "string"
        },
        "interarrival": {
          "discriminator": {
            "mapping": {
              "constant": "#/$defs/Constant",
              "exponential": "#/$defs/Exponential",
              "normal": "#/$defs/Normal",
              "uniform": "#/$defs/Uniform"
            },
            "propertyName": "kind"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/Constant"
            },
            {
              "$ref": "#/$defs/Exponential"
            },
            {
              "$ref": "#/$defs/Normal"
            },
            {
              "$ref": "#/$defs/Uniform"
            }
          ],
          "title": "Interarrival"
        },
        "kind": {
          "const": "source",
          "title": "Kind",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "id",
        "interarrival"
      ],
      "title": "Source",
      "type": "object"
    },
    "SourceRef": {
      "additionalProperties": false,
      "description": "The code a model stands for, as Muundo analysed it.",
      "properties": {
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "path": {
          "default": "",
          "description": "The analysed directory, relative to the repository",
          "title": "Path",
          "type": "string"
        },
        "report": {
          "anyOf": [
            {
              "$ref": "#/$defs/ArtifactRef"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Muundo's report, stored as a file, so it travels with the bundle"
        },
        "repository": {
          "description": "Where the code lives: a URL or a name",
          "minLength": 1,
          "title": "Repository",
          "type": "string"
        },
        "revision": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The commit or tag analysed",
          "title": "Revision"
        },
        "snapshot": {
          "anyOf": [
            {
              "pattern": "^blake3:[0-9a-f]{64}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Muundo's snapshot id: the identity of the source files and of the analyser",
          "title": "Snapshot"
        }
      },
      "required": [
        "repository"
      ],
      "title": "SourceRef",
      "type": "object"
    },
    "Station": {
      "additionalProperties": false,
      "description": "A resource that processes one item per unit of capacity; others queue.",
      "properties": {
        "capacity": {
          "default": 1,
          "minimum": 1,
          "title": "Capacity",
          "type": "integer"
        },
        "id": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
          "title": "Id",
          "type": "string"
        },
        "kind": {
          "const": "station",
          "title": "Kind",
          "type": "string"
        },
        "processing": {
          "discriminator": {
            "mapping": {
              "constant": "#/$defs/Constant",
              "exponential": "#/$defs/Exponential",
              "normal": "#/$defs/Normal",
              "uniform": "#/$defs/Uniform"
            },
            "propertyName": "kind"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/Constant"
            },
            {
              "$ref": "#/$defs/Exponential"
            },
            {
              "$ref": "#/$defs/Normal"
            },
            {
              "$ref": "#/$defs/Uniform"
            }
          ],
          "title": "Processing"
        }
      },
      "required": [
        "kind",
        "id",
        "processing"
      ],
      "title": "Station",
      "type": "object"
    },
    "TargetDevice": {
      "additionalProperties": false,
      "description": "What a target's code runs on. `emulated-processor`: the code built for a\nprocessor, run in an emulator (QEMU). `bench`: real hardware, reached\nthrough a bridge the operator configures; it is never named in a record.",
      "properties": {
        "architecture": {
          "default": "",
          "description": "The processor, e.g. aarch64",
          "title": "Architecture",
          "type": "string"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "kind": {
          "enum": [
            "emulated-processor",
            "bench"
          ],
          "title": "Kind",
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "title": "TargetDevice",
      "type": "object"
    },
    "TargetModel": {
      "additionalProperties": false,
      "description": "Control code running outside Mokili \u2014 on an emulated processor or on a\nbench \u2014 driven step by step over the mokili-step/1 protocol. Used only as a\ncomponent of a coupled model.",
      "properties": {
        "assumptions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Assumptions",
          "type": "array"
        },
        "bench": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Benches: its name in the operator's configuration",
          "title": "Bench"
        },
        "description": {
          "default": "",
          "title": "Description",
          "type": "string"
        },
        "device": {
          "$ref": "#/$defs/TargetDevice"
        },
        "inputs": {
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "minItems": 1,
          "title": "Inputs",
          "type": "array"
        },
        "kind": {
          "const": "target",
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "outputs": {
          "items": {
            "$ref": "#/$defs/Quantity"
          },
          "minItems": 1,
          "title": "Outputs",
          "type": "array"
        },
        "program": {
          "anyOf": [
            {
              "$ref": "#/$defs/ArtifactRef"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Emulated processors: the executable built for it"
        },
        "protocol": {
          "const": "mokili-step/1",
          "default": "mokili-step/1",
          "title": "Protocol",
          "type": "string"
        },
        "schema": {
          "const": "mokili.model/1",
          "title": "Schema",
          "type": "string"
        },
        "sources": {
          "default": [],
          "description": "The code this model stands for, if it stands for software",
          "items": {
            "$ref": "#/$defs/SourceRef"
          },
          "title": "Sources",
          "type": "array"
        },
        "time_unit": {
          "default": "s",
          "minLength": 1,
          "title": "Time Unit",
          "type": "string"
        }
      },
      "required": [
        "schema",
        "kind",
        "name",
        "device",
        "inputs",
        "outputs"
      ],
      "title": "TargetModel",
      "type": "object"
    },
    "TranslatedFrom": {
      "additionalProperties": false,
      "description": "The Modelica source an equations model was translated from, by `sala import-modelica`.",
      "properties": {
        "libraries": {
          "default": [],
          "description": "The libraries whose classes the model is built from, such as the Modelica Standard Library",
          "items": {
            "$ref": "#/$defs/LibraryUsed"
          },
          "title": "Libraries",
          "type": "array"
        },
        "model": {
          "description": "The Modelica class translated",
          "minLength": 1,
          "title": "Model",
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/ArtifactRef",
          "description": "The .mo file, stored by its digest; it travels with the model's bundles"
        },
        "translator": {
          "description": "What translated it, and its version",
          "minLength": 1,
          "title": "Translator",
          "type": "string"
        }
      },
      "required": [
        "source",
        "model",
        "translator"
      ],
      "title": "TranslatedFrom",
      "type": "object"
    },
    "Uniform": {
      "additionalProperties": false,
      "properties": {
        "high": {
          "title": "High",
          "type": "number"
        },
        "kind": {
          "const": "uniform",
          "title": "Kind",
          "type": "string"
        },
        "low": {
          "minimum": 0,
          "title": "Low",
          "type": "number"
        }
      },
      "required": [
        "kind",
        "low",
        "high"
      ],
      "title": "Uniform",
      "type": "object"
    }
  },
  "$id": "mokili.model/1",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "discriminator": {
    "mapping": {
      "coupled": "#/$defs/CoupledModel",
      "engine": "#/$defs/EngineModel",
      "equations": "#/$defs/EquationsModel",
      "flow": "#/$defs/FlowModel",
      "fmu": "#/$defs/FmuModel",
      "netlogo": "#/$defs/NetLogoModel",
      "qualitative": "#/$defs/QualitativeModel",
      "target": "#/$defs/TargetModel"
    },
    "propertyName": "kind"
  },
  "oneOf": [
    {
      "$ref": "#/$defs/FlowModel"
    },
    {
      "$ref": "#/$defs/FmuModel"
    },
    {
      "$ref": "#/$defs/NetLogoModel"
    },
    {
      "$ref": "#/$defs/QualitativeModel"
    },
    {
      "$ref": "#/$defs/CoupledModel"
    },
    {
      "$ref": "#/$defs/TargetModel"
    },
    {
      "$ref": "#/$defs/EngineModel"
    },
    {
      "$ref": "#/$defs/EquationsModel"
    }
  ]
}
