{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openfutureforum.github.io/executive-intelligence-index/schema/statement.schema.json",
  "title": "Statement",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "statement_id",
    "source_id",
    "statement_type",
    "neutral_paraphrase",
    "exact_locator",
    "locator_type",
    "source_date",
    "topic_ids",
    "evidence_character",
    "factual_verification_status",
    "statement_scope",
    "extraction_method",
    "provenance"
  ],
  "properties": {
    "statement_id": {
      "type": "string",
      "minLength": 1
    },
    "source_id": {
      "type": "string",
      "minLength": 1
    },
    "person_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "institutional_author": {
      "type": [
        "string",
        "null"
      ]
    },
    "book_edition_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "speaker_role_at_source_time": {
      "type": [
        "string",
        "null"
      ]
    },
    "organization_at_source_time": {
      "type": [
        "string",
        "null"
      ]
    },
    "statement_type": {
      "$ref": "common.schema.json#/$defs/statementType"
    },
    "neutral_paraphrase": {
      "type": "string",
      "minLength": 1
    },
    "direct_quote": {
      "type": [
        "string",
        "null"
      ]
    },
    "direct_quote_rights_note": {
      "type": [
        "string",
        "null"
      ]
    },
    "exact_locator": {
      "type": "string",
      "minLength": 1
    },
    "locator_type": {
      "type": "string",
      "minLength": 1
    },
    "source_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "topic_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true,
      "minItems": 1
    },
    "executive_role_context": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "industry_context": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "geographic_context": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "evidence_character": {
      "type": "string",
      "minLength": 1
    },
    "factual_verification_status": {
      "type": "string",
      "minLength": 1
    },
    "statement_scope": {
      "type": "string",
      "minLength": 1
    },
    "uncertainty": {
      "type": [
        "string",
        "null"
      ]
    },
    "extraction_method": {
      "type": "string",
      "minLength": 1
    },
    "machine_extraction_confidence": {
      "type": [
        "number",
        "null"
      ]
    },
    "independent_agent_review_status": {
      "type": "string",
      "minLength": 1
    },
    "publication_status": {
      "type": [
        "string",
        "null"
      ]
    },
    "workflow_status": {
      "$ref": "common.schema.json#/$defs/workflowStatus"
    },
    "machine_review_status": {
      "$ref": "common.schema.json#/$defs/machineReviewStatus"
    },
    "human_review_status": {
      "$ref": "common.schema.json#/$defs/humanReviewStatus"
    },
    "reviewed_by": {
      "type": [
        "string",
        "null"
      ]
    },
    "reviewed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "provenance": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "common.schema.json#/$defs/provenance"
      }
    },
    "revision_history": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/revision"
      }
    }
  },
  "allOf": [
    {
      "anyOf": [
        {
          "required": [
            "person_id"
          ]
        },
        {
          "required": [
            "institutional_author"
          ]
        }
      ]
    },
    {
      "if": {
        "properties": {
          "locator_type": {
            "const": "page"
          }
        }
      },
      "then": {
        "required": [
          "book_edition_id"
        ]
      }
    }
  ]
}
