{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aicdapi-com/json-schema/aicdapi-com-upcoming-agenda-hits-envelope-schema.json",
  "title": "UpcomingAgendaHitsEnvelope",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aicdapi-com-agenda-hits-api-openapi.yml#/components/schemas/UpcomingAgendaHitsEnvelope",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "data",
    "meta"
  ],
  "properties": {
    "data": {
      "description": "One page of upcoming hits. A cursor request returns `hits` and `nextCursor`, plus `totalCount` when `count=true`; a legacy `page` request returns `hits`, `totalCount`, `page`, and `pageSize`.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hits"
      ],
      "properties": {
        "hits": {
          "description": "Upcoming classified hits for the requested topic in meeting-time order. An empty array means no upcoming classified hit for that topic right now; a backend failure returns the same empty page, so it is not proof that a body has no meetings.",
          "type": "array",
          "maxItems": 10,
          "items": {
            "$ref": "#/$defs/UpcomingAgendaHit"
          }
        },
        "nextCursor": {
          "description": "Cursor responses only. Null when the last page was returned.",
          "type": [
            "string",
            "null"
          ]
        },
        "totalCount": {
          "description": "Legacy `page` responses, and cursor responses that ask for `count=true`.",
          "type": "integer",
          "minimum": 0
        },
        "page": {
          "description": "Legacy `page` responses only.",
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "pageSize": {
          "description": "Legacy `page` responses only.",
          "type": "integer",
          "const": 10
        }
      },
      "oneOf": [
        {
          "$ref": "#/$defs/CursorAgendaHitsPage"
        },
        {
          "$ref": "#/$defs/LegacyAgendaHitsPage"
        }
      ]
    },
    "meta": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "pagination"
      ],
      "properties": {
        "pagination": {
          "$ref": "#/$defs/PaginationMeta"
        }
      }
    }
  },
  "$defs": {
    "AffectedLocation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "sourceText"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "exact_address",
            "parcel_or_case",
            "zip_code",
            "council_district",
            "corridor",
            "named_development",
            "neighborhood",
            "citywide"
          ]
        },
        "sourceText": {
          "type": "string",
          "maxLength": 160
        }
      }
    },
    "AffectedLocationValue": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "locations"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "stated",
            "not_stated"
          ]
        },
        "locations": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/AffectedLocation"
          }
        }
      }
    },
    "AgendaProceduralContext": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "proceduralStage",
        "actingBodyRole",
        "nextBodyName",
        "nextMeetingDate",
        "actionKind",
        "actionUrl"
      ],
      "properties": {
        "proceduralStage": {
          "type": "string",
          "enum": [
            "proposed",
            "scheduled",
            "recommended",
            "continued",
            "approved",
            "denied",
            "adopted",
            "unknown"
          ]
        },
        "actingBodyRole": {
          "type": "string",
          "enum": [
            "recommending",
            "final_decision_maker",
            "unknown"
          ]
        },
        "nextBodyName": {
          "type": [
            "string",
            "null"
          ]
        },
        "nextMeetingDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "actionKind": {
          "type": "string",
          "enum": [
            "public_comment",
            "registration",
            "meeting",
            "staff_contact",
            "unknown"
          ]
        },
        "actionUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        }
      }
    },
    "CursorAgendaHitsPage": {
      "description": "A cursor page. `data.nextCursor`, and `data.totalCount` when `count=true`.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hits",
        "nextCursor"
      ],
      "properties": {
        "hits": {
          "type": "array",
          "maxItems": 10,
          "items": {
            "$ref": "#/$defs/UpcomingAgendaHit"
          }
        },
        "nextCursor": {
          "type": [
            "string",
            "null"
          ]
        },
        "totalCount": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "LegacyAgendaHitsPage": {
      "description": "A legacy `page` response. `data.page`, `data.pageSize`, and `data.totalCount`.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hits",
        "totalCount",
        "page",
        "pageSize"
      ],
      "properties": {
        "hits": {
          "type": "array",
          "maxItems": 10,
          "items": {
            "$ref": "#/$defs/UpcomingAgendaHit"
          }
        },
        "totalCount": {
          "type": "integer",
          "minimum": 0
        },
        "page": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "pageSize": {
          "type": "integer",
          "const": 10
        }
      }
    },
    "PaginationMeta": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "limit",
        "returned",
        "nextCursor"
      ],
      "properties": {
        "limit": {
          "type": "integer",
          "const": 10
        },
        "returned": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "nextCursor": {
          "type": [
            "string",
            "null"
          ],
          "description": "Opaque cursor for the next page, or null when traversal is complete."
        }
      }
    },
    "UpcomingAgendaHit": {
      "description": "One classified hit with the id the detail route takes. The fields are the recent-hits fields plus `matchId`, published flat so a reader sees every field without resolving a composed schema.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "matchId",
        "jurisdictionSlug",
        "jurisdictionName",
        "bodyName",
        "topicSlug",
        "meetingAt",
        "title",
        "summary",
        "businessImpact",
        "evidenceQuote",
        "sourceUrl",
        "confidence",
        "affectedLocation",
        "proceduralContext"
      ],
      "properties": {
        "matchId": {
          "type": "string",
          "format": "uuid",
          "description": "Id for `GET /api/v1/public/agenda-hits/{matchId}`."
        },
        "jurisdictionSlug": {
          "type": "string"
        },
        "jurisdictionName": {
          "type": "string"
        },
        "bodyName": {
          "type": "string"
        },
        "topicSlug": {
          "type": "string"
        },
        "meetingAt": {
          "type": "string",
          "format": "date-time"
        },
        "meetingTimePrecision": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "date",
            "time",
            "unknown",
            null
          ],
          "description": "Optional precision. date has no supplied clock; time is a verified source clock; unknown is unverified. Absent or null preserves pre-contract legacy precision and does not certify a clock."
        },
        "title": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "businessImpact": {
          "type": "string"
        },
        "evidenceQuote": {
          "type": "string"
        },
        "sourceUrl": {
          "type": "string",
          "format": "uri"
        },
        "confidence": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "affectedLocation": {
          "$ref": "#/$defs/AffectedLocationValue"
        },
        "proceduralContext": {
          "$ref": "#/$defs/AgendaProceduralContext"
        }
      }
    }
  }
}