{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://uqp.dev/spec/schemas/question-catalog.json",
  "title": "QuestionCatalog",
  "type": "object",
  "properties": {
    "pack_id": {
      "$ref": "common.json#/$defs/packId"
    },
    "pack_version": {
      "$ref": "common.json#/$defs/packVersion"
    },
    "provenance": {
      "type": "string",
      "minLength": 1
    },
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "enum": [
              "text",
              "string",
              "number",
              "boolean",
              "single_select",
              "multi_select",
              "object"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "factor_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true
          },
          "options": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "value": {},
                    "label": {
                      "type": "string",
                      "minLength": 1
                    },
                    "multiplier": {
                      "type": "number",
                      "minimum": 0
                    },
                    "width": {
                      "type": "number",
                      "minimum": 0
                    },
                    "height": {
                      "type": "number",
                      "minimum": 0
                    },
                    "provenance": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "value",
                    "label"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "description": {
            "type": "string",
            "minLength": 1
          },
          "unit": {
            "type": "string",
            "minLength": 1
          },
          "provenance": {
            "type": "string",
            "minLength": 1
          },
          "source_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true
          },
          "evidence_count": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "enum": [
              "assumption",
              "unvalidated"
            ]
          },
          "show_if": {
            "type": "object",
            "properties": {
              "question_id": {
                "type": "string",
                "minLength": 1
              },
              "equals": {
                "type": "boolean"
              }
            },
            "required": [
              "question_id",
              "equals"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "label",
          "type",
          "required"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "pack_id",
    "pack_version",
    "questions"
  ],
  "additionalProperties": false
}
