{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mantic/json-schema/mantic-condition-preview-response-schema.json",
  "title": "ConditionPreviewResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mantic-scenarios-api-openapi.yml#/components/schemas/ConditionPreviewResponse",
  "properties": {
    "question_id": {
      "type": "integer",
      "title": "Question Id"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "output_type": {
      "type": "string",
      "enum": [
        "binary",
        "numerical",
        "date"
      ],
      "title": "Output Type"
    },
    "resolution_time": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolution Time"
    },
    "range_min": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Range Min"
    },
    "range_max": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Range Max"
    },
    "unit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Unit"
    },
    "window_start": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Window Start"
    },
    "window_end": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Window End"
    },
    "suggested_threshold": {
      "anyOf": [
        {
          "$ref": "#/$defs/NumericalThreshold"
        },
        {
          "$ref": "#/$defs/DateThreshold"
        },
        {
          "type": "null"
        }
      ],
      "title": "Suggested Threshold"
    },
    "thresholds": {
      "items": {
        "$ref": "#/$defs/ConditionThresholdPreview"
      },
      "type": "array",
      "title": "Thresholds"
    }
  },
  "type": "object",
  "required": [
    "question_id",
    "title",
    "output_type",
    "thresholds"
  ],
  "$defs": {
    "ConditionThresholdPreview": {
      "properties": {
        "p_a": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "P A"
        },
        "expected_settles_on": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expected Settles On"
        },
        "unavailable_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unavailable Reason"
        },
        "listed": {
          "type": "boolean",
          "title": "Listed",
          "default": false
        }
      },
      "type": "object",
      "title": "ConditionThresholdPreview"
    },
    "DateThreshold": {
      "properties": {
        "comparator": {
          "type": "string",
          "title": "Comparator"
        },
        "date": {
          "type": "string",
          "title": "Date"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "comparator",
        "date"
      ],
      "title": "DateThreshold",
      "description": "One threshold on a date question, as an ISO calendar date with no time of day."
    },
    "NumericalThreshold": {
      "properties": {
        "comparator": {
          "type": "string",
          "title": "Comparator"
        },
        "value": {
          "type": "number",
          "title": "Value"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "comparator",
        "value"
      ],
      "title": "NumericalThreshold",
      "description": "One threshold on a numerical question."
    }
  }
}