{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/witwiki-app/json-schema/witwiki-app-import-report-schema.json",
  "title": "ImportReport",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/witwiki-app-openapi.yaml#/components/schemas/ImportReport",
  "type": "object",
  "properties": {
    "verdict": {
      "type": "string",
      "enum": [
        "pass",
        "needs_review",
        "invalid"
      ],
      "description": "At least needs_review while a page has no decision or a target is planned or written."
    },
    "project_id": {
      "type": "string",
      "description": "The project the import writes into, for links to its pages; set whether or not the import has finished."
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "paused",
        "failed",
        "cancelled",
        "done"
      ],
      "description": "The import's status, so an unfinished one says how far it got."
    },
    "step": {
      "type": "string",
      "enum": [
        "read",
        "digest",
        "plan",
        "write",
        "check",
        "finish"
      ]
    },
    "targets": {
      "type": "object",
      "description": "The wiki pages the plan made, counted by state.",
      "properties": {
        "planned": {
          "type": "integer"
        },
        "written": {
          "type": "integer"
        },
        "checked": {
          "type": "integer"
        },
        "needs_person": {
          "type": "integer"
        }
      }
    },
    "needs_attention": {
      "type": "integer",
      "description": "Open disagreements plus targets that need a person plus missing pages; the number the ready email gives."
    },
    "quality": {
      "type": "object",
      "additionalProperties": true,
      "description": "importquality's report of the run: counts, sections, archive rate and findings."
    },
    "open_disagreements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "target": {
            "type": "string",
            "description": "The wiki path of the page holding the block."
          },
          "title": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        }
      }
    },
    "missing_pages": {
      "type": "array",
      "description": "Targets whose page the import wrote (written, checked, or needing a person) that have no page at their path now. A disagreement on a missing page is neither open nor resolved and is listed nowhere else. Any missing page makes the verdict at least needs_review.",
      "items": {
        "type": "object",
        "properties": {
          "target": {
            "type": "string",
            "description": "The wiki path the page was at."
          },
          "title": {
            "type": "string"
          },
          "disagreements": {
            "type": "integer",
            "description": "How many disagreements the import recorded on it."
          }
        }
      }
    },
    "missing_facts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "target": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "fact": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "The Notion page's title; empty when the fact is about the whole page."
          },
          "raw_source_id": {
            "type": "string",
            "description": "The Notion page's saved original, to link to; empty when the fact is about the whole page or no original was saved."
          }
        }
      }
    },
    "left_out": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "raw_source_id": {
            "type": "string",
            "description": "The saved original; empty when none was saved."
          },
          "url": {
            "type": "string"
          },
          "superseded_by": {
            "type": "string",
            "description": "The wiki path of the page that replaced it; empty when none did."
          }
        }
      }
    },
    "not_checked": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "complete": {
      "type": "boolean",
      "description": "True only when the import is done."
    }
  }
}