{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ai-analytics.org/sanders/schema.json",
  "title": "Sanders public-record research release",
  "description": "Source-linked records. checkedOn is a source/index review date; accessStatus distinguishes acquired/reviewed sources from indexed-only references. Financial periods differ from publication dates.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "meta": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1
        },
        "reviewedOn": {
          "type": "string",
          "format": "date"
        },
        "scope": {
          "type": "string",
          "minLength": 1
        },
        "reuse": {
          "type": "string",
          "minLength": 1
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": [
        "title",
        "reviewedOn",
        "scope",
        "reuse",
        "limitations"
      ]
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "publisher": {
            "type": "string",
            "minLength": 1
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "documentDate": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "checkedOn": {
            "type": "string",
            "format": "date"
          },
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "locator": {
            "type": "string",
            "minLength": 1
          },
          "sha256": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "accessStatus": {
            "enum": [
              "source_reviewed",
              "indexed_reference_only",
              "bulk_receipt"
            ]
          },
          "note": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "id",
          "title",
          "publisher",
          "url",
          "documentDate",
          "checkedOn",
          "kind",
          "locator",
          "sha256",
          "accessStatus"
        ]
      }
    },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[a-zA-Z0-9-]+$"
          },
          "category": {
            "enum": [
              "personal-finance",
              "campaign-finance",
              "organizations",
              "policy",
              "oversight"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "period": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "type": "string",
            "minLength": 1
          },
          "summary": {
            "type": "string",
            "minLength": 1
          },
          "facts": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "value": {
                  "type": "string",
                  "minLength": 1
                },
                "note": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "label",
                "value"
              ]
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "minItems": 1
          },
          "sourceIds": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "id",
          "category",
          "title",
          "date",
          "period",
          "status",
          "summary",
          "facts",
          "limitations",
          "sourceIds",
          "tags"
        ]
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "text": {
            "type": "string",
            "minLength": 1
          },
          "sourceIds": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "recordIds": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "id",
          "title",
          "text",
          "sourceIds",
          "recordIds"
        ]
      }
    },
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "question": {
            "type": "string",
            "minLength": 1
          },
          "known": {
            "type": "string",
            "minLength": 1
          },
          "needed": {
            "type": "string",
            "minLength": 1
          },
          "sourceIds": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "id",
          "question",
          "known",
          "needed",
          "sourceIds"
        ]
      }
    }
  },
  "required": [
    "schemaVersion",
    "meta",
    "sources",
    "records",
    "findings",
    "questions"
  ]
}
