{
  "$defs": {
    "Property": {
      "additionalProperties": false,
      "description": "What a requirement asks of every run, as a test on its series.\n\n`never`: the condition is false at every sample. `always`: true at every\nsample. `responds_within`: each time `trigger` becomes true, `response` is\ntrue at some sample no more than `within` later.",
      "properties": {
        "condition": {
          "anyOf": [
            {
              "$ref": "#/$defs/SeriesCondition"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "kind": {
          "enum": [
            "never",
            "always",
            "responds_within"
          ],
          "title": "Kind",
          "type": "string"
        },
        "response": {
          "anyOf": [
            {
              "$ref": "#/$defs/SeriesCondition"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "trigger": {
          "anyOf": [
            {
              "$ref": "#/$defs/SeriesCondition"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "within": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Within"
        }
      },
      "required": [
        "kind"
      ],
      "title": "Property",
      "type": "object"
    },
    "SeriesCondition": {
      "additionalProperties": false,
      "description": "A test on one series at one instant: `h > 1.9`.",
      "properties": {
        "op": {
          "enum": [
            "<",
            "<=",
            ">",
            ">="
          ],
          "title": "Op",
          "type": "string"
        },
        "series": {
          "minLength": 1,
          "title": "Series",
          "type": "string"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The series' unit, checked before the test",
          "title": "Unit"
        },
        "value": {
          "title": "Value",
          "type": "number"
        }
      },
      "required": [
        "series",
        "op",
        "value"
      ],
      "title": "SeriesCondition",
      "type": "object"
    }
  },
  "$id": "mokili.requirement/1",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "A requirement a run can be checked against: the sentence people agreed\non, and the property that tests it.",
  "properties": {
    "id": {
      "description": "The requirement's identifier, e.g. REQ-TANK-01",
      "pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,63}$",
      "title": "Id",
      "type": "string"
    },
    "property": {
      "$ref": "#/$defs/Property"
    },
    "rationale": {
      "default": "",
      "title": "Rationale",
      "type": "string"
    },
    "schema": {
      "const": "mokili.requirement/1",
      "title": "Schema",
      "type": "string"
    },
    "text": {
      "description": "The requirement as written",
      "minLength": 1,
      "title": "Text",
      "type": "string"
    },
    "title": {
      "minLength": 1,
      "title": "Title",
      "type": "string"
    }
  },
  "required": [
    "schema",
    "id",
    "title",
    "text",
    "property"
  ],
  "title": "Requirement",
  "type": "object"
}
