{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vaquill-ai/json-schema/vaquill-ai-fact-set-schema.json",
  "title": "FactSet",
  "description": "One generated ledger.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vaquill-ai-facts-api-openapi.yml#/components/schemas/FactSet",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "`fct_` identifier. The same id the operation's resource carries."
    },
    "matterId": {
      "type": "string",
      "title": "Matterid",
      "description": "The `mat_` matter this set covers."
    },
    "status": {
      "$ref": "#/$defs/OperationStatus",
      "description": "The generation's status, in the same five values every operation uses."
    },
    "mode": {
      "type": "string",
      "title": "Mode",
      "description": "How this set was generated. `standard` re-reads the matter, `incremental` reads only what changed. Sets generated from the web app may report `deep`, which this API does not accept."
    },
    "isCurrent": {
      "type": "boolean",
      "title": "Iscurrent",
      "description": "True for the one set in force for this matter. Generating a new set makes the previous one `false`; nothing is deleted, and its facts stay readable."
    },
    "isStale": {
      "type": "boolean",
      "title": "Isstale",
      "description": "True when the matter's documents have changed since this set was built. Computed per request against the current document set, never stored."
    },
    "changedDocCount": {
      "type": "integer",
      "title": "Changeddoccount",
      "description": "How many documents the matter has gained since this set was generated. Zero with `isStale` true means documents were re-ingested rather than added."
    },
    "coverage": {
      "$ref": "#/$defs/FactSetCoverage",
      "description": "What the generation read."
    },
    "factCount": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Factcount",
      "description": "Facts in the set, once it has finished."
    },
    "conflictCount": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Conflictcount",
      "description": "Facts the reducer flagged as conflicted."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "title": "Createdat",
      "description": "When the generation was requested."
    },
    "completedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Completedat",
      "description": "When the generation finished. Null until it does."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "id",
    "matterId",
    "status",
    "mode",
    "isCurrent",
    "isStale",
    "changedDocCount",
    "coverage",
    "createdAt"
  ],
  "$defs": {
    "FactSetCoverage": {
      "properties": {
        "included": {
          "type": "integer",
          "title": "Included",
          "description": "Documents whose evidence went into this set."
        },
        "total": {
          "type": "integer",
          "title": "Total",
          "description": "Documents in the matter at generation time."
        },
        "excluded": {
          "type": "integer",
          "title": "Excluded",
          "description": "Documents in the matter that this generation did not read, because it hit the per-run inline ceiling. Generate again to pick up more."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "included",
        "total",
        "excluded"
      ],
      "title": "FactSetCoverage",
      "description": "What the generation actually read, and what it did not.\n\nNot decoration. The reducer extracts at most 60 documents inline, so on a\nlarger matter `included` is 60 and `excluded` is the rest, while the\noperation reports 60 of 60 and looks complete. It IS complete, for what it\nread. This is the only place that says what that was."
    },
    "OperationStatus": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "cancelled"
      ],
      "title": "OperationStatus",
      "description": "The public five. There is no sixth, and there are no synonyms.\n\nInternal vocabularies spell terminal success `completed`, `ready`,\n`extracted`, `succeeded` and `fresh`; terminal failure `failed` and `error`;\nqueued `pending`, `queued` and `draft`. All of that is collapsed here by\n`app.workspace_api.adapters.status_map`, which refuses to guess."
    }
  }
}