{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/media-buy/get-reporting-status-response.json",
  "title": "Get Reporting Status Response",
  "x-status": "experimental",
  "description": "Authoritative caller/account-isolated reporting status response. The view echoes the request and discriminates summary, periods, exact revision, and fatal error shapes. Seller obligation/revision state and separately attributed consumer status remain distinct but are compared in the caller-scoped health projection. Every identifier, cursor, ledger snapshot, destination, revision, materialization, consumer status, and resource is scoped to the authenticated caller and account.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/version-envelope.json"
    },
    {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/protocol-envelope.json"
    },
    {
      "if": {
        "properties": {
          "health": {
            "const": "complete"
          }
        },
        "required": [
          "health"
        ]
      },
      "then": {
        "properties": {
          "scope": {
            "properties": {
              "scope_closed": {
                "const": true
              },
              "coverage_complete": {
                "const": true
              }
            },
            "required": [
              "scope_closed",
              "coverage_complete"
            ]
          }
        },
        "not": {
          "required": [
            "next_expected_at"
          ]
        }
      }
    },
    {
      "if": {
        "properties": {
          "health": {
            "const": "action_required"
          }
        },
        "required": [
          "health"
        ]
      },
      "then": {
        "properties": {
          "issues": {
            "minItems": 1,
            "contains": {
              "properties": {
                "severity": {
                  "const": "action_required"
                }
              },
              "required": [
                "severity"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "health": {
            "const": "delayed"
          }
        },
        "required": [
          "health"
        ]
      },
      "then": {
        "properties": {
          "issues": {
            "minItems": 1,
            "items": {
              "properties": {
                "severity": {
                  "const": "delayed"
                }
              }
            }
          }
        },
        "required": [
          "issues"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "health": {
            "enum": [
              "healthy",
              "waiting",
              "complete"
            ]
          }
        },
        "required": [
          "health"
        ]
      },
      "then": {
        "properties": {
          "issues": {
            "maxItems": 0
          }
        },
        "required": [
          "issues"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "scope": {
            "properties": {
              "coverage_complete": {
                "const": false
              }
            },
            "required": [
              "coverage_complete"
            ]
          }
        },
        "required": [
          "scope"
        ]
      },
      "then": {
        "properties": {
          "health": {
            "const": "action_required"
          },
          "issues": {
            "minItems": 1,
            "contains": {
              "properties": {
                "code": {
                  "const": "HISTORY_UNAVAILABLE"
                },
                "severity": {
                  "const": "action_required"
                }
              },
              "required": [
                "code",
                "severity"
              ]
            }
          }
        },
        "required": [
          "issues"
        ]
      }
    }
  ],
  "properties": {
    "view": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/media-buy/get-reporting-status-request.json#/definitions/ReportingStatusView"
    },
    "ledger_snapshot_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Opaque identity of the seller's consistent reporting-ledger snapshot. Every page reached from one periods cursor MUST return the same value."
    },
    "ledger_as_of": {
      "type": "string",
      "format": "date-time",
      "description": "Exclusive observation boundary for ledger_snapshot_id. Revisions committed later appear only in a later reconciliation."
    },
    "changes_checkpoint": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048,
      "description": "Opaque durable incremental-repair checkpoint for this periods snapshot. Consumers persist it only after consuming every page, then send it as changes_after. It is bound to authenticated caller, account, and filters and MUST order every committed obligation, revision, adjustment, materialization, consumer status statement, revision receipt, and adjustment receipt without gaps."
    },
    "account_id": {
      "type": "string",
      "minLength": 1,
      "x-entity": "account",
      "description": "Resolved seller/storefront account identifier."
    },
    "scope": {
      "type": "object",
      "description": "Exact denominator evaluated for summary or periods health. complete is valid only when scope_closed is true.",
      "properties": {
        "period_start": {
          "type": "string",
          "format": "date-time"
        },
        "period_end": {
          "type": "string",
          "format": "date-time"
        },
        "scope_closed": {
          "type": "boolean",
          "description": "True only when no new obligation can enter this evaluated scope."
        },
        "media_buy_ids": {
          "type": "array",
          "items": {
            "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-coverage.json#/definitions/ReportingMediaBuyId"
          },
          "uniqueItems": true
        },
        "all_accessible_media_buys": {
          "type": "boolean",
          "description": "True when media_buy_ids was omitted and the scope covers all caller-accessible account buys."
        },
        "delivery_config_generations": {
          "type": "array",
          "description": "Exact independently reconciled configuration generations in the denominator.",
          "items": {
            "type": "object",
            "properties": {
              "delivery_config_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "x-entity": "reporting_delivery_config"
              },
              "delivery_config_version": {
                "type": "integer",
                "minimum": 1
              },
              "feed_purpose": {
                "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-delivery-offering.json#/definitions/ReportingFeedPurpose"
              }
            },
            "required": [
              "delivery_config_id",
              "delivery_config_version",
              "feed_purpose"
            ],
            "additionalProperties": false
          },
          "uniqueItems": true
        },
        "feed_purposes": {
          "type": "array",
          "items": {
            "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-delivery-offering.json#/definitions/ReportingFeedPurpose"
          },
          "uniqueItems": true
        },
        "finality": {
          "type": "array",
          "items": {
            "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/enums/reporting-finality.json"
          },
          "uniqueItems": true
        },
        "ledger_retained_from": {
          "type": "string",
          "format": "date-time",
          "description": "Earliest period boundary for which anti-entropy metadata is retained for every selected configuration generation."
        },
        "coverage_complete": {
          "type": "boolean",
          "description": "Whether the requested horizon is fully inside retained ledger coverage. False means health cannot prove completeness for the whole requested horizon."
        }
      },
      "required": [
        "period_start",
        "period_end",
        "scope_closed",
        "all_accessible_media_buys",
        "delivery_config_generations",
        "feed_purposes",
        "finality",
        "ledger_retained_from",
        "coverage_complete"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "all_accessible_media_buys": {
                "const": false
              }
            },
            "required": [
              "all_accessible_media_buys"
            ]
          },
          "then": {
            "required": [
              "media_buy_ids"
            ]
          }
        }
      ],
      "additionalProperties": false
    },
    "health": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/enums/reporting-health.json"
    },
    "coverage": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-coverage.json",
      "description": "Aggregated effective coverage for the exact selected scope. This remains independent of reporting health and finality so a fresh covered subset cannot look like complete campaign reporting."
    },
    "data_through": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Conservative latest included event time across satisfied obligations in scope, or null when unavailable/unknown."
    },
    "next_expected_at": {
      "type": "string",
      "format": "date-time",
      "description": "Next obligation due time for an open scope. Omitted for a closed complete scope."
    },
    "obligation_counts": {
      "type": "object",
      "properties": {
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "waiting": {
          "type": "integer",
          "minimum": 0
        },
        "healthy": {
          "type": "integer",
          "minimum": 0
        },
        "delayed": {
          "type": "integer",
          "minimum": 0
        },
        "action_required": {
          "type": "integer",
          "minimum": 0
        },
        "complete": {
          "type": "integer",
          "minimum": 0
        },
        "consumer_status_pending": {
          "type": "integer",
          "minimum": 0,
          "description": "Obligations in this scope whose elapsed expected period has passed its consumer-status deadline — expected_at plus automated_recovery_window_seconds — without a current consumer status from the authenticated caller. A chain with any unsuperseded leaf counts as current whatever that leaf says; only an empty chain is pending. Because it counts obligations, a period the seller omitted entirely has no obligation and is not counted here — the buyer's independently derived denominator, not this field, remains the authority on omitted periods. It is a visibility count over the caller's own silence, never a health input: it MUST NOT change health, any other count, or seller-advertised reliability_statistics, and it overlaps the health counts rather than partitioning them. Required when the seller advertises consumer_status_task."
        }
      },
      "required": [
        "total",
        "waiting",
        "healthy",
        "delayed",
        "action_required",
        "complete"
      ],
      "additionalProperties": false
    },
    "issues": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-status-issue.json"
      }
    },
    "periods": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-obligation.json"
      }
    },
    "revisions": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-revision.json"
      },
      "description": "Revision ledger records on this page. Pagination is over the flat union of obligations, revisions, adjustments, materializations, consumer status statements, revision receipts, and adjustment receipts, avoiding unbounded nested history."
    },
    "adjustments": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-adjustment.json"
      },
      "description": "Immutable post-official accounting corrections on this page. They preserve the original invoice-to-revision binding and are included in flat ledger pagination."
    },
    "consumer_statuses": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-consumer-status.json"
      },
      "description": "Authenticated caller's append-only reporting status history on this page. Current leaves are identified by obligation current_consumer_status_id or, for a missing seller obligation, by the supersession chain over configuration generation, report definition, and period. No other consumer's status is disclosed."
    },
    "adjustment_receipts": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-adjustment-receipt.json"
      },
      "description": "Authenticated Reconciled Billing outcomes for adjustments on this page."
    },
    "pagination": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/pagination-response.json"
    },
    "revision": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-revision.json"
    },
    "materializations": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-materialization.json"
      }
    },
    "receipts": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/reporting-receipt.json"
      },
      "description": "Authenticated caller's durable reconciliation receipts. Receipts from another consumer principal are never disclosed."
    },
    "errors": {
      "type": "array",
      "items": {
        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/error.json"
      }
    },
    "context": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/context.json"
    },
    "ext": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/ext.json"
    }
  },
  "oneOf": [
    {
      "title": "Successful lookup",
      "properties": {
        "status": {
          "type": "string",
          "const": "completed"
        }
      },
      "required": [
        "status"
      ],
      "oneOf": [
        {
          "title": "Summary view",
          "properties": {
            "view": {
              "type": "string",
              "const": "summary"
            }
          },
          "required": [
            "view",
            "ledger_snapshot_id",
            "ledger_as_of",
            "account_id",
            "scope",
            "health",
            "coverage",
            "data_through",
            "obligation_counts",
            "issues"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "changes_checkpoint"
                ]
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "revisions"
                ]
              },
              {
                "required": [
                  "adjustments"
                ]
              },
              {
                "required": [
                  "consumer_statuses"
                ]
              },
              {
                "required": [
                  "adjustment_receipts"
                ]
              },
              {
                "required": [
                  "pagination"
                ]
              },
              {
                "required": [
                  "revision"
                ]
              },
              {
                "required": [
                  "materializations"
                ]
              },
              {
                "required": [
                  "receipts"
                ]
              }
            ]
          }
        },
        {
          "title": "Periods view",
          "properties": {
            "view": {
              "type": "string",
              "const": "periods"
            },
            "pagination": {
              "required": [
                "has_more",
                "total_count"
              ]
            }
          },
          "required": [
            "view",
            "ledger_snapshot_id",
            "ledger_as_of",
            "account_id",
            "scope",
            "periods",
            "revisions",
            "materializations",
            "receipts",
            "pagination"
          ],
          "not": {
            "required": [
              "revision"
            ]
          }
        },
        {
          "title": "Revision view",
          "properties": {
            "view": {
              "type": "string",
              "const": "revision"
            },
            "pagination": {
              "required": [
                "has_more",
                "total_count"
              ]
            }
          },
          "required": [
            "view",
            "ledger_snapshot_id",
            "ledger_as_of",
            "account_id",
            "revision",
            "materializations",
            "receipts",
            "pagination"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "changes_checkpoint"
                ]
              },
              {
                "required": [
                  "scope"
                ]
              },
              {
                "required": [
                  "health"
                ]
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "revisions"
                ]
              }
            ]
          }
        }
      ]
    },
    {
      "title": "Failed lookup",
      "properties": {
        "status": {
          "type": "string",
          "const": "failed"
        }
      },
      "required": [
        "status"
      ],
      "oneOf": [
        {
          "title": "Unavailable lookup",
          "type": "object",
          "properties": {
            "adcp_version": {
              "type": "string"
            },
            "adcp_major_version": {
              "type": "integer"
            },
            "status": {
              "type": "string",
              "const": "failed"
            },
            "view": {
              "enum": [
                "summary",
                "periods",
                "revision"
              ]
            },
            "failure_kind": {
              "type": "string",
              "const": "lookup_unavailable"
            },
            "context_id": {
              "type": "string"
            },
            "context": {
              "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/context.json"
            },
            "message": {
              "const": "Reporting status resource is unavailable."
            },
            "timestamp": {
              "type": "string",
              "format": "date-time"
            },
            "replayed": {
              "type": "boolean"
            },
            "adcp_error": {
              "type": "object",
              "properties": {
                "code": {
                  "const": "NOT_FOUND"
                },
                "message": {
                  "const": "Reporting status resource is unavailable."
                }
              },
              "required": [
                "code",
                "message"
              ],
              "additionalProperties": false
            },
            "errors": {
              "type": "array",
              "minItems": 1,
              "maxItems": 1,
              "items": {
                "type": "object",
                "properties": {
                  "code": {
                    "const": "NOT_FOUND"
                  },
                  "message": {
                    "const": "Reporting status resource is unavailable."
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "status",
            "view",
            "failure_kind",
            "errors"
          ],
          "additionalProperties": false
        },
        {
          "title": "Operational failure",
          "type": "object",
          "properties": {
            "adcp_version": {
              "type": "string"
            },
            "adcp_major_version": {
              "type": "integer"
            },
            "status": {
              "type": "string",
              "const": "failed"
            },
            "view": {
              "enum": [
                "summary",
                "periods",
                "revision"
              ]
            },
            "failure_kind": {
              "type": "string",
              "const": "operational"
            },
            "context_id": {
              "type": "string"
            },
            "context": {
              "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/context.json"
            },
            "message": {
              "type": "string"
            },
            "timestamp": {
              "type": "string",
              "format": "date-time"
            },
            "replayed": {
              "type": "boolean"
            },
            "adcp_error": {
              "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/error.json"
            },
            "errors": {
              "type": "array",
              "items": {
                "$ref": "https://adcontextprotocol.org/schemas/3.2.0-rc.3/core/error.json"
              },
              "minItems": 1
            }
          },
          "required": [
            "status",
            "view",
            "failure_kind",
            "errors"
          ],
          "additionalProperties": false
        }
      ]
    }
  ],
  "x-adcp-validation": {
    "caller_isolation": "Derive caller identity only from authenticated transport. Every account, configuration generation, cursor, changes checkpoint, ledger snapshot, revision, adjustment, materialization, consumer status, resource, and destination must belong to that caller/account; consumer_statuses contains only statements submitted by this authenticated caller. Unknown and unauthorized identifiers must use the identical lookup_unavailable shape. operational failures MUST NOT be used for identifier resolution or authorization failures.",
    "empty_scope": "After the caller intentionally applies reporting_delivery_configs: [], or before it creates any configuration, an unfiltered account has no caller-owned reporting configuration generations. delivery_config_generations, feed_purposes, and finality MUST all be empty; obligation counts and every periods-view record array, including consumer_statuses, MUST be empty; data_through MUST be null. This is a valid vacuously complete closed scope, not an inaccessible-identifier signal. A request naming an unknown or unauthorized delivery_config_id still uses lookup_unavailable.",
    "snapshot_consistency": "All pages reached from a cursor MUST preserve ledger_snapshot_id, ledger_as_of, and changes_checkpoint. A cursor or changes checkpoint is unusable by another caller, account, or filter set. Consumers MUST persist changes_checkpoint only after has_more is false.",
    "incremental_repair": "Reliable Reporting 1.0 periods responses require changes_checkpoint and adjustments, and revision responses require adjustments. A seller advertising consumer_status_task additionally requires consumer_statuses in both views, includes it in the same flat pagination and checkpoint ordering, and requires obligation_counts.consumer_status_pending on the summary view. adjustment_receipts is additionally required in both views when the seller advertises reconciled_billing: true and is otherwise optional. When changes_after is present, periods pagination MUST include every immutable ledger record committed strictly after that checkpoint through ledger_as_of and the current obligation projection for every affected obligation. It MAY safely replay older immutable records, which consumers deduplicate by record identity. Records committed during pagination appear after changes_checkpoint on the next read, never in the current snapshot. The returned changes_checkpoint advances across every supported record kind, including consumer status when supported, corrections, and adjustment receipts that do not change health. reporting.status_changed is repaired with a non-incremental current summary or periods read because clock/configuration health transitions need not commit an immutable record.",
    "revision_adjustments": "In revision view, every adjustments item MUST name the requested revision in adjusts_reporting_revision_id; every consumer_statuses item MUST name the requested revision; every adjustment_receipt, when supported, MUST name one of those adjustments. No unrelated status or correction may appear.",
    "resource_retention": "A complete obligation must retain at least one readable verified exact materialization through its resource_retained_until. Metadata retention does not imply resource readability after that boundary.",
    "coverage_aggregation": "Summary coverage is full only when every selected obligation is full; an explicit empty denominator is full. It is partial when the selected scope contains at least one covered package, fully covered media buy, or partially covered media buy and at least one partially covered, unsupported, or unknown item. A partially covered media buy counts as a covered item when excluding none and unknown. It is none when nothing is covered and support is known absent, and unknown when nothing is covered and any applicability remains unknown. Delivery health is computed separately. Covered-subset metrics MUST NOT be presented as complete totals for the selected media-buy scope.",
    "consumer_status_projection": "Seller obligation/revision state and authenticated consumer status remain separately attributed. received never satisfies seller production health or Reconciled Billing. Any current statement that conflicts with an otherwise healthy/complete seller projection makes only this caller/account view delayed or action_required with a stable CONSUMER_STATUS_MISMATCH issue carrying opened_at and referencing reporting_status_id: this includes obligation_missing, revision_missing, unreadable, content_mismatch, or received naming a revision that is no longer the current required revision after a seller restatement. The diagnosed responsible_party may be seller, buyer, or provider. Missing consumer status remains unknown, never excuses seller reporting, and does not by itself degrade seller health; it is surfaced only through obligation_counts.consumer_status_pending. A CONSUMER_STATUS_MISMATCH issue is retired only as described in reporting-status-issue.json consumer_mismatch_lifecycle; a seller MUST NOT return the period to healthy or complete while the causing statement is still the consumer's current leaf. Consumer assertions never contaminate another caller's view or seller-advertised reliability_statistics without corroboration.",
    "stale_received_grace": "A received statement made stale only by a later seller restatement is not an immediate escalation: the buyer read exactly what the seller required at the time and has not yet had a chance to re-read. The grace deadline is the created_at of the FIRST revision that superseded the revision the consumer named, plus the configuration generation's schedule.delivery_sla, computed as exact elapsed time in UTC — not civil-time arithmetic, so a calendar-valued delivery_sla resolves through the same fixed component lengths every implementation derives from the ISO 8601 duration. When that delivery_sla resolves to a zero duration in any of its legal spellings, the seller uses automated_recovery_window_seconds instead so a zero-SLA feed still yields a bounded re-read window. Before the deadline the mismatch MUST be emitted at severity delayed with recommended_action wait_for_retry, and this caller/account view is delayed rather than action_required. At or after it, and immediately for every other conflict kind, the issue is action_required. The same issue_id and opened_at carry across the transition so consumers can age one work item instead of two. Further restatements while the same mismatch is open MUST NOT restart the window: the deadline is anchored to the first supersession and to the issue, so a seller cannot hold a genuinely unresolved mismatch below action_required by restating on a timer. The consumer_mismatch_escalation_seconds boundary in reporting-status-issue.json additionally takes precedence when the two overlap.",
    "consumer_status_deadline": "A buyer owes a current consumer status for every elapsed expected period by expected_at plus automated_recovery_window_seconds, not merely before it closes the scope. Past that deadline with no current statement from the authenticated caller, the seller counts the obligation in obligation_counts.consumer_status_pending. Silence is a counted unknown only: it MUST NOT create an issue, change health, excuse a seller obligation, or appear in another caller's view."
  },
  "additionalProperties": true
}
