{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quickiso.app/data-portability/tables/questionnaire_items.schema.json",
  "title": "tables/questionnaire_items.json",
  "description": "The rows of the table questionnaire_items that belong to the workspace, one object per row, keyed by the database's column names.",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "organization_id": {
        "type": "string",
        "format": "uuid"
      },
      "questionnaire_id": {
        "type": "string",
        "format": "uuid"
      },
      "position": {
        "type": "integer"
      },
      "question": {
        "type": "string"
      },
      "suggested_entry_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "suggestion_score": {
        "type": [
          "number",
          "null"
        ]
      },
      "status": {
        "type": "string",
        "enum": [
          "open",
          "answered",
          "not_applicable"
        ]
      },
      "answer": {
        "type": [
          "string",
          "null"
        ]
      },
      "answer_entry_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "answered_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "answered_at": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "answer_origin": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "written",
          "library",
          "ai_draft",
          "ai_draft_edited",
          null
        ]
      },
      "source_location": {
        "type": [
          "object",
          "array",
          "string",
          "number",
          "boolean",
          "null"
        ]
      },
      "draft_outcome": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "drafted",
          "not_in_records",
          "blocked",
          "failed",
          null
        ]
      },
      "draft_answer": {
        "type": [
          "string",
          "null"
        ]
      },
      "draft_confidence": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "high",
          "medium",
          "low",
          null
        ]
      },
      "draft_citations": {
        "type": [
          "object",
          "array",
          "string",
          "number",
          "boolean",
          "null"
        ]
      },
      "draft_suspicious": {
        "type": "boolean"
      },
      "draft_reason": {
        "type": [
          "string",
          "null"
        ]
      },
      "draft_model": {
        "type": [
          "string",
          "null"
        ]
      },
      "drafted_at": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "draft_run_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "revision": {
        "type": "integer"
      }
    },
    "required": [
      "id",
      "organization_id",
      "questionnaire_id",
      "position",
      "question",
      "suggested_entry_id",
      "suggestion_score",
      "status",
      "answer",
      "answer_entry_id",
      "answered_by",
      "answered_at",
      "answer_origin",
      "source_location",
      "draft_outcome",
      "draft_answer",
      "draft_confidence",
      "draft_citations",
      "draft_suspicious",
      "draft_reason",
      "draft_model",
      "drafted_at",
      "draft_run_id",
      "revision"
    ],
    "additionalProperties": false
  }
}
