{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://uqp.dev/spec/schemas/factor-catalog.json",
  "title": "FactorCatalog",
  "type": "object",
  "properties": {
    "pack_id": {
      "$ref": "common.json#/$defs/packId"
    },
    "pack_version": {
      "$ref": "common.json#/$defs/packVersion"
    },
    "provenance": {
      "type": "string",
      "minLength": 1
    },
    "factors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "question_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true
          },
          "enabled_by_default": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "modeled",
              "not_yet_modeled"
            ]
          },
          "description": {
            "type": "string",
            "minLength": 1
          },
          "mode": {
            "type": "string",
            "minLength": 1
          },
          "modes": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "value": {},
          "values": {},
          "weight": {
            "type": "number"
          },
          "provenance": {
            "type": "string",
            "minLength": 1
          },
          "enabled": {
            "type": "boolean"
          },
          "source_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "uniqueItems": true
          },
          "evidence_count": {
            "type": "integer",
            "minimum": 0
          },
          "evidence_status": {
            "enum": [
              "assumption",
              "unvalidated"
            ]
          }
        },
        "required": [
          "id",
          "label",
          "question_ids",
          "enabled_by_default",
          "status"
        ],
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "const": "not_yet_modeled"
                }
              }
            },
            "then": {
              "properties": {
                "enabled_by_default": {
                  "const": false
                }
              }
            }
          }
        ]
      }
    }
  },
  "required": [
    "pack_id",
    "pack_version",
    "factors"
  ],
  "additionalProperties": false
}
