{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Inverse Transform Lab distribution",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "distribution"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "title": {
      "type": "string",
      "maxLength": 120
    },
    "unit": {
      "type": "string",
      "maxLength": 80
    },
    "description": {
      "type": "string",
      "maxLength": 600
    },
    "initialU": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "distribution": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "outcomes"
          ],
          "properties": {
            "type": {
              "const": "discrete"
            },
            "outcomes": {
              "type": "array",
              "minItems": 1,
              "maxItems": 1000,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "value",
                  "probability"
                ],
                "properties": {
                  "value": {
                    "type": "number",
                    "minimum": -1000000000000.0,
                    "maximum": 1000000000000.0
                  },
                  "probability": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                }
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "parameters"
          ],
          "properties": {
            "type": {
              "const": "normal"
            },
            "parameters": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "mean",
                "sd"
              ],
              "properties": {
                "mean": {
                  "type": "number",
                  "minimum": -1000000000.0,
                  "maximum": 1000000000.0
                },
                "sd": {
                  "type": "number",
                  "minimum": 1e-06,
                  "maximum": 1000000000.0
                }
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "parameters"
          ],
          "properties": {
            "type": {
              "const": "uniform"
            },
            "parameters": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "a",
                "b"
              ],
              "properties": {
                "a": {
                  "type": "number",
                  "minimum": -100,
                  "maximum": 100
                },
                "b": {
                  "type": "number",
                  "minimum": -100,
                  "maximum": 100
                }
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "parameters"
          ],
          "properties": {
            "type": {
              "const": "exponential"
            },
            "parameters": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "mean"
              ],
              "properties": {
                "mean": {
                  "type": "number",
                  "minimum": 0.01,
                  "maximum": 100
                }
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "parameters"
          ],
          "properties": {
            "type": {
              "const": "poisson"
            },
            "parameters": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "lambda"
              ],
              "properties": {
                "lambda": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100
                }
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "parameters"
          ],
          "properties": {
            "type": {
              "const": "binomial"
            },
            "parameters": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "n",
                "p"
              ],
              "properties": {
                "n": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100
                },
                "p": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              }
            }
          }
        }
      ]
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "distribution": {
            "properties": {
              "type": {
                "const": "discrete"
              }
            }
          }
        }
      },
      "then": {
        "properties": {
          "initialU": {
            "exclusiveMaximum": 1
          }
        }
      }
    }
  ],
  "$comment": "Runtime also requires finite numbers, unique outcome values, total probability within 1e-9 of 1, representable positive-probability intervals, uniform a < b, and a 256 KiB maximum UTF-8 document size."
}
