{
  "$defs": {
    "OptionOutcome": {
      "additionalProperties": false,
      "properties": {
        "admissible": {
          "title": "Admissible",
          "type": "boolean"
        },
        "criteria": {
          "additionalProperties": {
            "$ref": "#/$defs/OutputSpread"
          },
          "default": {},
          "title": "Criteria",
          "type": "object"
        },
        "failed": {
          "default": 0,
          "title": "Failed",
          "type": "integer"
        },
        "penalty": {
          "anyOf": [
            {
              "$ref": "#/$defs/OutputSpread"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The weighted penalty, when criteria are weighed: 0 the best on every criterion, 1 the worst"
        },
        "requirements": {
          "additionalProperties": {
            "$ref": "#/$defs/RequirementOdds"
          },
          "default": {},
          "title": "Requirements",
          "type": "object"
        },
        "runs": {
          "description": "One run per draw, in the order of the draws",
          "items": {
            "pattern": "^sha256:[0-9a-f]{64}$",
            "type": "string"
          },
          "title": "Runs",
          "type": "array"
        }
      },
      "required": [
        "runs",
        "admissible"
      ],
      "title": "OptionOutcome",
      "type": "object"
    },
    "OutputSpread": {
      "additionalProperties": false,
      "properties": {
        "maximum": {
          "title": "Maximum",
          "type": "number"
        },
        "mean": {
          "title": "Mean",
          "type": "number"
        },
        "minimum": {
          "title": "Minimum",
          "type": "number"
        },
        "n": {
          "title": "N",
          "type": "integer"
        },
        "p05": {
          "title": "P05",
          "type": "number"
        },
        "p50": {
          "title": "P50",
          "type": "number"
        },
        "p95": {
          "title": "P95",
          "type": "number"
        },
        "std": {
          "title": "Std",
          "type": "number"
        }
      },
      "required": [
        "n",
        "mean",
        "std",
        "minimum",
        "p05",
        "p50",
        "p95",
        "maximum"
      ],
      "title": "OutputSpread",
      "type": "object"
    },
    "RequirementOdds": {
      "additionalProperties": false,
      "properties": {
        "high": {
          "title": "High",
          "type": "number"
        },
        "holds": {
          "title": "Holds",
          "type": "integer"
        },
        "low": {
          "title": "Low",
          "type": "number"
        },
        "of": {
          "title": "Of",
          "type": "integer"
        },
        "probability": {
          "title": "Probability",
          "type": "number"
        }
      },
      "required": [
        "holds",
        "of",
        "probability",
        "low",
        "high"
      ],
      "title": "RequirementOdds",
      "type": "object"
    },
    "Turn": {
      "additionalProperties": false,
      "description": "Where another option beats the recommended one, and the simplest condition\non one uncertain parameter that tells those draws apart.",
      "properties": {
        "matches": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Draws the condition classifies right, wins and others",
          "title": "Matches"
        },
        "of": {
          "title": "Of",
          "type": "integer"
        },
        "option": {
          "title": "Option",
          "type": "string"
        },
        "parameter": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Parameter"
        },
        "side": {
          "anyOf": [
            {
              "enum": [
                "below",
                "above"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Side"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Threshold"
        },
        "wins": {
          "description": "Draws in which it meets the requirements and does better: a lower penalty, or the first criterion",
          "title": "Wins",
          "type": "integer"
        }
      },
      "required": [
        "option",
        "wins",
        "of"
      ],
      "title": "Turn",
      "type": "object"
    }
  },
  "$id": "mokili.decision-run/1",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "What a decision's runs found. Written by Mokili.",
  "properties": {
    "assumptions": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Assumptions",
      "type": "array"
    },
    "created_at": {
      "title": "Created At",
      "type": "string"
    },
    "decision": {
      "pattern": "^sha256:[0-9a-f]{64}$",
      "title": "Decision",
      "type": "string"
    },
    "domain": {
      "additionalProperties": {
        "maxItems": 2,
        "minItems": 2,
        "prefixItems": [
          {
            "type": "number"
          },
          {
            "type": "number"
          }
        ],
        "type": "array"
      },
      "default": {},
      "description": "The range each uncertain parameter covered: where the recommendation was tested",
      "title": "Domain",
      "type": "object"
    },
    "method": {
      "title": "Method",
      "type": "string"
    },
    "options": {
      "additionalProperties": {
        "$ref": "#/$defs/OptionOutcome"
      },
      "title": "Options",
      "type": "object"
    },
    "reason": {
      "title": "Reason",
      "type": "string"
    },
    "recommended": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "None when no option is admissible",
      "title": "Recommended"
    },
    "samples": {
      "description": "The uncertain values of each draw",
      "items": {
        "additionalProperties": {
          "type": "number"
        },
        "type": "object"
      },
      "title": "Samples",
      "type": "array"
    },
    "schema": {
      "const": "mokili.decision-run/1",
      "title": "Schema",
      "type": "string"
    },
    "turns": {
      "default": [],
      "items": {
        "$ref": "#/$defs/Turn"
      },
      "title": "Turns",
      "type": "array"
    }
  },
  "required": [
    "schema",
    "created_at",
    "decision",
    "samples",
    "options",
    "recommended",
    "reason",
    "method"
  ],
  "title": "DecisionRun",
  "type": "object"
}
