{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dnsdoctor-dev/json-schema/dnsdoctor-dev-bulk-reports-out-schema.json",
  "title": "BulkReportsOut",
  "description": "The batch. `reports_parsed` is what the settle gate reads.\n\n`combined` is one entry per reported domain (a report naming none is grouped\nunder `domain: null`), computed over the pooled rows of every parsed report\nfor it — a report sent twice (same reporter + report id) is pooled once, as\nintake's duplicate rule — `org_name`/`report_id` are null, the dates are the\nbatch's min/max.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dnsdoctor-dev-tools-api-openapi.yml#/components/schemas/BulkReportsOut",
  "properties": {
    "reports": {
      "items": {
        "$ref": "#/$defs/BulkReportRow"
      },
      "type": "array",
      "title": "Reports"
    },
    "combined": {
      "items": {
        "$ref": "#/$defs/ReportParseResponse"
      },
      "type": "array",
      "title": "Combined"
    },
    "reports_parsed": {
      "type": "integer",
      "title": "Reports Parsed"
    }
  },
  "type": "object",
  "required": [
    "reports",
    "combined",
    "reports_parsed"
  ],
  "$defs": {
    "BulkReportRow": {
      "properties": {
        "index": {
          "type": "integer",
          "title": "Index"
        },
        "filename": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Filename"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok",
            "bad_base64",
            "too_large",
            "not_a_report",
            "unparseable",
            "deadline"
          ],
          "title": "Status"
        },
        "report": {
          "anyOf": [
            {
              "$ref": "#/$defs/ReportParseResponse"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "index",
        "filename",
        "status"
      ],
      "title": "BulkReportRow",
      "description": "One report's outcome, in request order. `report` is set only when `ok`."
    },
    "ReportDispositionMix": {
      "properties": {
        "none": {
          "type": "integer",
          "title": "None"
        },
        "quarantine": {
          "type": "integer",
          "title": "Quarantine"
        },
        "reject": {
          "type": "integer",
          "title": "Reject"
        }
      },
      "type": "object",
      "required": [
        "none",
        "quarantine",
        "reject"
      ],
      "title": "ReportDispositionMix",
      "description": "Report-wide message counts by evaluated disposition."
    },
    "ReportParseResponse": {
      "properties": {
        "org_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Org Name"
        },
        "report_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Report Id"
        },
        "domain": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Domain"
        },
        "published_policy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Published Policy"
        },
        "date_begin": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Date Begin"
        },
        "date_end": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Date End"
        },
        "total_messages": {
          "type": "integer",
          "title": "Total Messages"
        },
        "aligned_messages": {
          "type": "integer",
          "title": "Aligned Messages"
        },
        "aligned_pct": {
          "type": "number",
          "title": "Aligned Pct"
        },
        "dispositions": {
          "$ref": "#/$defs/ReportDispositionMix"
        },
        "sources": {
          "items": {
            "$ref": "#/$defs/ReportSourceOut"
          },
          "type": "array",
          "title": "Sources"
        }
      },
      "type": "object",
      "required": [
        "org_name",
        "report_id",
        "domain",
        "published_policy",
        "date_begin",
        "date_end",
        "total_messages",
        "aligned_messages",
        "aligned_pct",
        "dispositions",
        "sources"
      ],
      "title": "ReportParseResponse",
      "description": "One parsed DMARC aggregate report — metadata + per-source aggregates.\n\nZero-persistence: assembled straight from the shared parser's output and\ndiscarded after the response. No record strings, no LLM — the read-only\nacquisition twin of the authenticated backfill upload."
    },
    "ReportSourceOut": {
      "properties": {
        "ip": {
          "type": "string",
          "title": "Ip"
        },
        "total": {
          "type": "integer",
          "title": "Total"
        },
        "spf_aligned_pct": {
          "type": "number",
          "title": "Spf Aligned Pct"
        },
        "dkim_aligned_pct": {
          "type": "number",
          "title": "Dkim Aligned Pct"
        },
        "aligned_pct": {
          "type": "number",
          "title": "Aligned Pct"
        }
      },
      "type": "object",
      "required": [
        "ip",
        "total",
        "spf_aligned_pct",
        "dkim_aligned_pct",
        "aligned_pct"
      ],
      "title": "ReportSourceOut",
      "description": "One sending source, aggregated across the report's per-source records."
    }
  }
}