{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "urn:mime:saved-form:mime.document/6",
 "title": "MIME saved form, mime.document/6",
 "description": "What the experiment declares, written by registered name and version, settings and bindings, and nothing else: never code, never a copy of a record's values. ``profile`` is the profile it is built under; ``declared`` holds the values declared in the experiment, each with its reason; ``sources`` each setting's source given apart from its value (``exp.source``); ``gravity`` is its magnitude, along ``-up``, absent where the experiment states none (standard gravity, by convention); ``conditions`` the operating conditions every record is read at; ``materials`` each material by name, as a reference to its record; ``controller`` the controller, or null. Version 4 adds what may be shared, each absent where nothing is declared: ``licence``, the experiment's own (an SPDX expression; absent, it declares none, which ``save`` and ``pack`` never refuse and ``push`` will); ``licences``, each custom licence named, by its ``LicenseRef-`` id; ``terms``, each third-party file's, by its path below the folder; and ``permissions``, each declared permission (``mime.terms``). Version 5 adds ``run.duration``, the length of a run of the experiment, absent where it declares none. Version 6 adds nothing to the document; its schema moves with the lock's, which holds an asset's full record and the manifests of the meshes its stage draws.\n\nGenerated from the closed TypedDicts of mime.saved for editors. MIME's loader is the authority: this schema is a second reader of the same annotations and differs from the loader as follows.\n- duplicate-key: A mapping that holds one key twice: the document's YAML loader refuses it, and a schema sees the data a parser made of the text, in which one of the two values is already gone.\n- integral-float: An integer written with a zero fractional part (a seed of three written as three point nought): the loader refuses it as not an integer, and JSON Schema counts it an integer.\n- non-finite: A number that is not finite (NaN or an infinity): both readers take it as a number, and strict JSON cannot hold it. The document's writer refuses one; on a load, only a later check of the value itself refuses it, where one exists (a run's step must be finite).\n- non-string-key: A mapping key that is not a string (YAML reads an unquoted number or date as one): the loader refuses it, and JSON, where every key is a string, has no word for it.\n- earlier-form: A document or a lock of an earlier form of the saved form: the loader reads it under the current form, upgrading it, and each schema describes the current form alone, so it refuses the earlier form's schema id (and any key the current form renamed).\n- meaning: A value of the right shape that names nothing or the wrong thing: a unit, a registered entry and its version, a setting, a record or a file, a lock's file names and package names, a run's duration that is not a whole number of base steps. The shape is all either reader checks; the load refuses these later, each by its own code.",
 "$ref": "#/$defs/ExperimentDocument",
 "$defs": {
  "AcceptanceDoc": {
   "type": "object",
   "description": "The experiment's acceptance of a read answered ``unknown``: the reasons it covers, and why.",
   "properties": {
    "covers": {
     "type": "array",
     "items": {
      "type": "string"
     }
    },
    "reason": {
     "$ref": "#/$defs/ReasonDoc"
    }
   },
   "required": [
    "covers",
    "reason"
   ],
   "additionalProperties": false
  },
  "AssetDoc": {
   "type": "object",
   "description": "An asset by name, with the sha256 of the contents the experiment was written against (``{asset: dejongh_mlp_v2, sha256: ...}``): a load refuses other contents under that name.",
   "properties": {
    "asset": {
     "type": "string"
    },
    "sha256": {
     "type": "string"
    }
   },
   "required": [
    "asset",
    "sha256"
   ],
   "additionalProperties": false
  },
  "BoundEntryDoc": {
   "type": "object",
   "description": "An interaction or an observation: an entry with its id and the things or fields bound to its roles, by name.",
   "properties": {
    "id": {
     "type": "string"
    },
    "name": {
     "type": "string"
    },
    "version": {
     "type": "string"
    },
    "binds": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "settings": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/SettingValue"
     }
    }
   },
   "required": [
    "binds",
    "id",
    "name",
    "version"
   ],
   "additionalProperties": false
  },
  "ChosenDoc": {
   "type": "object",
   "description": "A value the experimenter chose, with why (``chosen(...)``): ``{chosen: <text>}``.",
   "properties": {
    "chosen": {
     "type": "string"
    }
   },
   "required": [
    "chosen"
   ],
   "additionalProperties": false
  },
  "ConditionDoc": {
   "type": "object",
   "description": "An operating condition every record is read at: its value and tolerance in SI, with their unit, and the value's reason where it carries one.",
   "properties": {
    "value": {
     "type": "number"
    },
    "plus_minus": {
     "type": "number"
    },
    "unit": {
     "type": "string"
    },
    "reason": {
     "$ref": "#/$defs/ReasonDoc"
    }
   },
   "required": [
    "plus_minus",
    "unit",
    "value"
   ],
   "additionalProperties": false
  },
  "ControllerDoc": {
   "type": "object",
   "description": "The experiment's controller: its entry by name and version with the settings written differently from their defaults; its mode, by word; each read label's path and each write label's command; its rate (a period) and latency, when declared.",
   "properties": {
    "name": {
     "type": "string"
    },
    "version": {
     "type": "string"
    },
    "settings": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/SettingValue"
     }
    },
    "mode": {
     "enum": [
      "graph",
      "callback",
      "client",
      "fmu"
     ]
    },
    "reads": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "writes": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "rate": {
     "$ref": "#/$defs/QuantityDoc"
    },
    "latency": {
     "$ref": "#/$defs/QuantityDoc"
    }
   },
   "required": [
    "mode",
    "name",
    "reads",
    "version",
    "writes"
   ],
   "additionalProperties": false
  },
  "CustomLicenceDoc": {
   "type": "object",
   "description": "A custom licence by its ``LicenseRef-`` id: its title, its https link, and what a person says it allows (``unknown`` or ``not_permitted``; a licence that permits is a permission).",
   "properties": {
    "title": {
     "type": "string"
    },
    "url": {
     "type": "string"
    },
    "redistribution": {
     "enum": [
      "not_permitted",
      "unknown"
     ]
    }
   },
   "required": [
    "redistribution",
    "title",
    "url"
   ],
   "additionalProperties": false
  },
  "DeclaredDoc": {
   "type": "object",
   "description": "A value declared in the experiment (``umr.mass``): in SI, with its unit and its reason.",
   "properties": {
    "value": {
     "anyOf": [
      {
       "type": "number"
      },
      {
       "type": "array",
       "items": {
        "type": "number"
       }
      }
     ]
    },
    "unit": {
     "type": "string"
    },
    "reason": {
     "$ref": "#/$defs/ReasonDoc"
    }
   },
   "required": [
    "reason",
    "unit",
    "value"
   ],
   "additionalProperties": false
  },
  "DurationDoc": {
   "type": "object",
   "description": "The run's length as SI value and SI unit symbol (``{value: 3.0, unit: s}``): a quantity with no reason, since nothing about the length of a run is a physical value or a numerical choice a profile judges.",
   "properties": {
    "value": {
     "type": "number"
    },
    "unit": {
     "type": "string"
    }
   },
   "required": [
    "unit",
    "value"
   ],
   "additionalProperties": false
  },
  "DynamicsDoc": {
   "type": "object",
   "description": "A thing's dynamics, one entry per aspect: a body's or a structure's motion, a medium's flow.",
   "properties": {
    "motion": {
     "$ref": "#/$defs/EntryDoc"
    },
    "flow": {
     "$ref": "#/$defs/EntryDoc"
    }
   },
   "required": [],
   "additionalProperties": false
  },
  "EntryDoc": {
   "type": "object",
   "description": "A registered entry by name and version, with the settings written differently from its defaults. An alias such as ``ToyDrag.Quadratic()`` saves as its family with the rung among the settings.",
   "properties": {
    "name": {
     "type": "string"
    },
    "version": {
     "type": "string"
    },
    "settings": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/SettingValue"
     }
    }
   },
   "required": [
    "name",
    "version"
   ],
   "additionalProperties": false
  },
  "EvidenceDoc": {
   "type": "object",
   "description": "A permission's evidence: its kind and its pointer (a public statement's link, or what a written permission is and who holds it).",
   "properties": {
    "kind": {
     "enum": [
      "public_statement",
      "written_permission"
     ]
    },
    "pointer": {
     "type": "string"
    }
   },
   "required": [
    "kind",
    "pointer"
   ],
   "additionalProperties": false
  },
  "ExperimentDocument": {
   "type": "object",
   "description": "What the experiment declares, written by registered name and version, settings and bindings, and nothing else: never code, never a copy of a record's values. ``profile`` is the profile it is built under; ``declared`` holds the values declared in the experiment, each with its reason; ``sources`` each setting's source given apart from its value (``exp.source``); ``gravity`` is its magnitude, along ``-up``, absent where the experiment states none (standard gravity, by convention); ``conditions`` the operating conditions every record is read at; ``materials`` each material by name, as a reference to its record; ``controller`` the controller, or null. Version 4 adds what may be shared, each absent where nothing is declared: ``licence``, the experiment's own (an SPDX expression; absent, it declares none, which ``save`` and ``pack`` never refuse and ``push`` will); ``licences``, each custom licence named, by its ``LicenseRef-`` id; ``terms``, each third-party file's, by its path below the folder; and ``permissions``, each declared permission (``mime.terms``). Version 5 adds ``run.duration``, the length of a run of the experiment, absent where it declares none. Version 6 adds nothing to the document; its schema moves with the lock's, which holds an asset's full record and the manifests of the meshes its stage draws.",
   "properties": {
    "schema": {
     "const": "mime.document/6"
    },
    "mime": {
     "type": "string"
    },
    "experiment": {
     "type": "string"
    },
    "profile": {
     "enum": [
      "exploratory",
      "research",
      "strict"
     ]
    },
    "run": {
     "$ref": "#/$defs/RunDoc"
    },
    "scene": {
     "$ref": "#/$defs/SceneDoc"
    },
    "gravity": {
     "$ref": "#/$defs/QuantityDoc"
    },
    "sources": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/ReasonDoc"
     }
    },
    "conditions": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/ConditionDoc"
     }
    },
    "things": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/ThingDoc"
     }
    },
    "interactions": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/BoundEntryDoc"
     }
    },
    "observations": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/BoundEntryDoc"
     }
    },
    "declared": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/DeclaredDoc"
     }
    },
    "materials": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/MaterialDoc"
     }
    },
    "controller": {
     "anyOf": [
      {
       "$ref": "#/$defs/ControllerDoc"
      },
      {
       "type": "null"
      }
     ]
    },
    "licence": {
     "type": "string"
    },
    "licences": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/CustomLicenceDoc"
     }
    },
    "terms": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/TermsDoc"
     }
    },
    "permissions": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/PermissionDoc"
     }
    }
   },
   "required": [
    "conditions",
    "controller",
    "declared",
    "experiment",
    "interactions",
    "materials",
    "mime",
    "observations",
    "profile",
    "run",
    "scene",
    "schema",
    "sources",
    "things"
   ],
   "additionalProperties": false
  },
  "ExtrapolationDoc": {
   "type": "object",
   "description": "How the experiment extends a table past its readable range, with its basis and reason.",
   "properties": {
    "method": {
     "enum": [
      "constant",
      "linear"
     ]
    },
    "basis": {
     "type": "string"
    },
    "reason": {
     "type": "string"
    }
   },
   "required": [
    "basis",
    "method",
    "reason"
   ],
   "additionalProperties": false
  },
  "FileDoc": {
   "type": "object",
   "description": "A file an entry reads (a robot's description), by its path below the document's folder, where ``save`` writes it, with the SHA-256 of its bytes (``{file: descriptions/<pin prefix>-ar4.urdf, sha256: ...}``): an entry reading other bytes is refused.",
   "properties": {
    "file": {
     "type": "string"
    },
    "sha256": {
     "type": "string"
    }
   },
   "required": [
    "file",
    "sha256"
   ],
   "additionalProperties": false
  },
  "GroupDoc": {
   "type": "object",
   "description": "A group of settings written together (``Lubrication(epsilon=...)``), by its registered group name, with its settings written differently from their defaults; a group holds no group.",
   "properties": {
    "group": {
     "type": "string"
    },
    "settings": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/GroupedValue"
     }
    }
   },
   "required": [
    "group",
    "settings"
   ],
   "additionalProperties": false
  },
  "GroupedValue": {
   "anyOf": [
    {
     "type": "null"
    },
    {
     "type": "boolean"
    },
    {
     "type": "integer"
    },
    {
     "type": "number"
    },
    {
     "type": "string"
    },
    {
     "type": "array",
     "items": {
      "$ref": "#/$defs/GroupedValue"
     }
    },
    {
     "$ref": "#/$defs/QuantityDoc"
    },
    {
     "$ref": "#/$defs/AssetDoc"
    },
    {
     "$ref": "#/$defs/FileDoc"
    }
   ]
  },
  "MagnetDoc": {
   "type": "object",
   "description": "A part's role as a magnet: its model, and its direction in the part's frame when the experiment declares it rather than the part's prim.",
   "properties": {
    "model": {
     "const": "permanent_magnet"
    },
    "direction": {
     "type": "array",
     "items": {
      "type": "number"
     }
    }
   },
   "required": [
    "model"
   ],
   "additionalProperties": false
  },
  "MaterialDoc": {
   "type": "object",
   "description": "A material read from a record: the record's reference, the tokens the experiment accepts in every read (``require``), and by record field its acceptances, nominal values and extrapolations, each with its reason.",
   "properties": {
    "record": {
     "$ref": "#/$defs/RecordDoc"
    },
    "require": {
     "type": "object",
     "additionalProperties": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    },
    "accept": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/AcceptanceDoc"
     }
    },
    "nominal": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/NominalDoc"
     }
    },
    "extrapolation": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/ExtrapolationDoc"
     }
    }
   },
   "required": [
    "record"
   ],
   "additionalProperties": false
  },
  "NominalDoc": {
   "type": "object",
   "description": "The value the experiment uses from an interval, in SI with its unit, and why: the experiment's number, never the record's.",
   "properties": {
    "value": {
     "type": "number"
    },
    "unit": {
     "type": "string"
    },
    "reason": {
     "$ref": "#/$defs/ReasonDoc"
    }
   },
   "required": [
    "reason",
    "unit",
    "value"
   ],
   "additionalProperties": false
  },
  "PartDoc": {
   "type": "object",
   "description": "A part: its solid (a geometry kind, by name and version with its settings), where its centroid sits in a body written Python-first, or in the frame an apparatus's part is mounted on, the material it is made of, by name, the part it lies inside, and an apparatus's part's mount (``<segment>.<frame>``).",
   "properties": {
    "solid": {
     "$ref": "#/$defs/EntryDoc"
    },
    "at": {
     "$ref": "#/$defs/QuantityDoc"
    },
    "material": {
     "type": "string"
    },
    "inside": {
     "type": "string"
    },
    "mount": {
     "type": "string"
    }
   },
   "required": [
    "solid"
   ],
   "additionalProperties": false
  },
  "PendingDoc": {
   "type": "object",
   "description": "A reason left pending (``pending()``): ``{pending: true}``.",
   "properties": {
    "pending": {
     "const": true
    }
   },
   "required": [
    "pending"
   ],
   "additionalProperties": false
  },
  "PermissionDoc": {
   "type": "object",
   "description": "A permission as declared: the rights holder and who was permitted, the files by sha256, the scope, the date and the evidence. Its form is checked; its truth never is.",
   "properties": {
    "grantor": {
     "type": "string"
    },
    "grantee": {
     "type": "string"
    },
    "files": {
     "type": "array",
     "items": {
      "type": "string"
     }
    },
    "scope": {
     "$ref": "#/$defs/ScopeDoc"
    },
    "date": {
     "type": "string"
    },
    "evidence": {
     "$ref": "#/$defs/EvidenceDoc"
    }
   },
   "required": [
    "date",
    "evidence",
    "files",
    "grantee",
    "grantor",
    "scope"
   ],
   "additionalProperties": false
  },
  "QuantityDoc": {
   "type": "object",
   "description": "A quantity as SI value and SI unit symbol (``{value: 0.02, unit: s}``), with its reason where it carries one.",
   "properties": {
    "value": {
     "anyOf": [
      {
       "type": "number"
      },
      {
       "type": "array",
       "items": {
        "type": "number"
       }
      }
     ]
    },
    "unit": {
     "type": "string"
    },
    "reason": {
     "$ref": "#/$defs/ReasonDoc"
    }
   },
   "required": [
    "unit",
    "value"
   ],
   "additionalProperties": false
  },
  "ReasonDoc": {
   "anyOf": [
    {
     "type": "string"
    },
    {
     "$ref": "#/$defs/PendingDoc"
    },
    {
     "$ref": "#/$defs/ChosenDoc"
    }
   ]
  },
  "RecordDoc": {
   "type": "object",
   "description": "A record file the experiment names: its file below the document's folder, where ``save`` writes it, the SHA-256 of its bytes, and the record's id, version and content hash. A reference: never a value from it.",
   "properties": {
    "file": {
     "type": "string"
    },
    "sha256": {
     "type": "string"
    },
    "id": {
     "type": "string"
    },
    "version": {
     "type": "string"
    },
    "content_hash": {
     "type": "string"
    }
   },
   "required": [
    "content_hash",
    "file",
    "id",
    "sha256",
    "version"
   ],
   "additionalProperties": false
  },
  "ReferenceDoc": {
   "type": "object",
   "description": "An asset layer referenced into the scene: the prim it is referenced at, its file below the document's folder, and its pin.",
   "properties": {
    "at": {
     "type": "string"
    },
    "layer": {
     "type": "string"
    },
    "sha256": {
     "type": "string"
    }
   },
   "required": [
    "at",
    "layer",
    "sha256"
   ],
   "additionalProperties": false
  },
  "RunDoc": {
   "type": "object",
   "description": "The run settings: the base step, the seed, and, where the experiment declares one (version 5), the length of a run of it (``mime run`` on the folder runs that long unless it is told another).",
   "properties": {
    "dt": {
     "$ref": "#/$defs/QuantityDoc"
    },
    "seed": {
     "type": "integer"
    },
    "duration": {
     "$ref": "#/$defs/DurationDoc"
    }
   },
   "required": [
    "dt",
    "seed"
   ],
   "additionalProperties": false
  },
  "SceneDoc": {
   "type": "object",
   "description": "The scene: up, once, the unit its stage is written in, and the asset layers it references.",
   "properties": {
    "up": {
     "type": "array",
     "items": {
      "type": "number"
     }
    },
    "units": {
     "type": "string"
    },
    "references": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/ReferenceDoc"
     }
    }
   },
   "required": [
    "references",
    "units",
    "up"
   ],
   "additionalProperties": false
  },
  "ScopeDoc": {
   "type": "object",
   "description": "What a permission allows.",
   "properties": {
    "redistribute": {
     "type": "boolean"
    },
    "modify": {
     "type": "boolean"
    },
    "commercial": {
     "type": "boolean"
    }
   },
   "required": [
    "commercial",
    "modify",
    "redistribute"
   ],
   "additionalProperties": false
  },
  "SegmentDoc": {
   "type": "object",
   "description": "A segment of an apparatus's chain: its name in the chain, and its dynamics by registered name and version with its settings. A chain is a list of them, in chain order.",
   "properties": {
    "segment": {
     "type": "string"
    },
    "name": {
     "type": "string"
    },
    "version": {
     "type": "string"
    },
    "settings": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/SettingValue"
     }
    }
   },
   "required": [
    "name",
    "segment",
    "version"
   ],
   "additionalProperties": false
  },
  "SettingValue": {
   "anyOf": [
    {
     "type": "null"
    },
    {
     "type": "boolean"
    },
    {
     "type": "integer"
    },
    {
     "type": "number"
    },
    {
     "type": "string"
    },
    {
     "type": "array",
     "items": {
      "$ref": "#/$defs/SettingValue"
     }
    },
    {
     "$ref": "#/$defs/QuantityDoc"
    },
    {
     "$ref": "#/$defs/AssetDoc"
    },
    {
     "$ref": "#/$defs/FileDoc"
    },
    {
     "$ref": "#/$defs/GroupDoc"
    }
   ]
  },
  "TermsDoc": {
   "type": "object",
   "description": "A third-party file's terms, by its path below the folder: the sha256 of the bytes they were declared for (a changed file inherits nothing), its licence as an SPDX expression, the credit its licence asks for, its role, and where its exact bytes can be fetched from, primary first.",
   "properties": {
    "sha256": {
     "type": "string"
    },
    "licence": {
     "type": "string"
    },
    "credit": {
     "type": "string"
    },
    "role": {
     "enum": [
      "results",
      "presentation"
     ]
    },
    "origin": {
     "type": "array",
     "items": {
      "type": "string"
     }
    }
   },
   "required": [
    "credit",
    "licence",
    "role",
    "sha256"
   ],
   "additionalProperties": false
  },
  "ThingDoc": {
   "type": "object",
   "description": "A thing: its kind, its prim (a scene path, an experiment name like the thing's own) and dynamics; a body's initial state, its parts and their roles; a structure's geometry kind; the region a medium fills (``tube.lumen``) and its material, by name; an apparatus's chain, parts and magnets, its fields and the drive of each command.",
   "properties": {
    "kind": {
     "enum": [
      "structure",
      "medium",
      "body",
      "apparatus"
     ]
    },
    "prim": {
     "type": "string"
    },
    "dynamics": {
     "$ref": "#/$defs/DynamicsDoc"
    },
    "initial": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/SettingValue"
     }
    },
    "fields": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/EntryDoc"
     }
    },
    "geometry": {
     "$ref": "#/$defs/EntryDoc"
    },
    "fills": {
     "type": "string"
    },
    "material": {
     "type": "string"
    },
    "commands": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/EntryDoc"
     }
    },
    "magnets": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/MagnetDoc"
     }
    },
    "parts": {
     "type": "object",
     "additionalProperties": {
      "$ref": "#/$defs/PartDoc"
     }
    },
    "chain": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/SegmentDoc"
     }
    }
   },
   "required": [
    "kind",
    "prim"
   ],
   "additionalProperties": false
  }
 }
}
