{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "structuredData.fetch.input.json",
  "title": "structured_data_fetch input",
  "description": "Read structured datasets or Stage1 rollups. listVersions and version are dataset-only; kind mode rejects these options with structured_data_fetch-specific OODS-V202.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "dataset": {
      "type": "string",
      "enum": [
        "components",
        "tokens",
        "manifest"
      ],
      "description": "Local structured dataset to return (components/tokens/manifest). Mutually exclusive with kind+runPath."
    },
    "kind": {
      "type": "string",
      "enum": [
        "identity_graph",
        "capability_rollup",
        "object_rollup",
        "drift_report",
        "derived_analysis",
        "a11y_report",
        "report_index",
        "a11y_evidence",
        "run_manifest"
      ],
      "description": "Stage1 artifact kind, with runPath; excludes dataset. Admits run_manifest through 1.8.0, a11y_report 2.2.0–2.5.0 and 3.0.0, drift_report 1.0.0–1.4.0 and 2.0.0, report_index 1.0.0/1.1.0 and a11y_evidence 1.1.0–1.4.0. derived_analysis admits analysis 1.0.0/1.1.0, fig_local_tokens 1.0.0/1.3.0/1.5.0/1.6.0 and style_fingerprint 1.3.0/1.4.0, with retained-file digests, lineage and JSON Pointer checks. Earlier admitted versions remain readable; unknown versions and suite roots are refused."
    },
    "runPath": {
      "type": "string",
      "minLength": 1,
      "description": "Filesystem path to a Stage1 run directory or its artifacts/ subdirectory. Required when kind is set."
    },
    "ifNoneMatch": {
      "type": "string",
      "minLength": 8,
      "description": "Return matched=true without payload when the ETag matches."
    },
    "includePayload": {
      "type": "boolean",
      "default": true,
      "description": "When false, omit payload even if no ETag match occurs."
    },
    "version": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Request a specific date-stamped version (e.g., '2026-02-24'). Omit for latest. Applies to dataset mode only."
    },
    "listVersions": {
      "type": "boolean",
      "default": false,
      "description": "When true, return available version dates instead of payload."
    },
    "includeInternal": {
      "type": "boolean",
      "default": false,
      "description": "Live components dataset only: also list OODS Foundry's internal (non-business) objects, after the business objects. Without it they are left out and registry.hiddenInternal counts them; a dated export is served unchanged."
    },
    "payloadMode": {
      "type": "string",
      "enum": [
        "inline",
        "file"
      ],
      "description": "Unset: inline, unless the payload exceeds 100,000 characters; then it is written to a file and warning OODS-W004 says so. inline always returns it; file always writes it and returns payloadFile."
    },
    "detail": {
      "type": "string",
      "enum": [
        "summary",
        "full"
      ],
      "description": "Dataset only. summary returns section counts and the call for page 1; full (default) preserves the dataset."
    },
    "page": {
      "type": "integer",
      "minimum": 1,
      "description": "Dataset only: read a 1-based page of lossless JSON Pointer entries, each reply below 100,000 characters. Omit for full data."
    },
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "Dataset entries per page, default 10, also bounded by serialized size. Reply meta gives next and full calls."
    }
  },
  "oneOf": [
    {
      "required": [
        "dataset"
      ],
      "not": {
        "required": [
          "kind"
        ]
      }
    },
    {
      "required": [
        "kind",
        "runPath"
      ],
      "not": {
        "required": [
          "dataset"
        ]
      }
    }
  ]
}
