{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xp-tickets/json-schema/xp-tickets-ticket-price-matrix-schema.json",
  "title": "TicketPriceMatrix",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xp-tickets-openapi.yml#/components/schemas/TicketPriceMatrix",
  "type": "object",
  "required": [
    "event_id",
    "quantity",
    "rows",
    "include",
    "max_price_per_ticket",
    "prices_as_of",
    "counts",
    "levels"
  ],
  "properties": {
    "event_id": {
      "type": "string"
    },
    "quantity": {
      "type": "integer"
    },
    "rows": {
      "type": "string",
      "enum": [
        "best",
        "all"
      ],
      "description": "The view requested."
    },
    "include": {
      "type": "array",
      "description": "The flags put back in, as requested.",
      "items": {
        "type": "string",
        "enum": [
          "obstructed_view",
          "standing_only"
        ]
      }
    },
    "max_price_per_ticket": {
      "nullable": true,
      "description": "The `max_price_per_ticket` filter as requested; null when not sent.",
      "allOf": [
        {
          "$ref": "#/$defs/Money"
        }
      ]
    },
    "prices_as_of": {
      "type": "string",
      "format": "date-time",
      "description": "When the oldest vendor feed behind these prices was read. Up to an hour ago."
    },
    "counts": {
      "type": "object",
      "required": [
        "listings",
        "sections",
        "rows"
      ],
      "properties": {
        "listings": {
          "type": "integer"
        },
        "sections": {
          "type": "integer"
        },
        "rows": {
          "type": "integer"
        }
      }
    },
    "levels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PriceMatrixLevel"
      }
    }
  },
  "$defs": {
    "Money": {
      "type": "object",
      "description": "A monetary amount. `amount` is an integer in minor units of `currency`, never a float; `exponent` is how many decimal places turn it into major units (2 for USD, so 111800 is $1,118.00); `display` is the same amount formatted for people and models.",
      "required": [
        "amount",
        "currency",
        "exponent",
        "display"
      ],
      "properties": {
        "amount": {
          "type": "integer"
        },
        "currency": {
          "type": "string",
          "description": "ISO 4217, uppercase."
        },
        "exponent": {
          "type": "integer"
        },
        "display": {
          "type": "string"
        }
      }
    },
    "PriceMatrixLevel": {
      "type": "object",
      "required": [
        "name",
        "listings",
        "get_in_per_ticket",
        "sections"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "listings": {
          "type": "integer"
        },
        "get_in_per_ticket": {
          "description": "The cheapest row on the level, per ticket.",
          "allOf": [
            {
              "$ref": "#/$defs/Money"
            }
          ]
        },
        "sections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PriceMatrixSection"
          }
        }
      }
    },
    "PriceMatrixRow": {
      "type": "object",
      "required": [
        "id",
        "row",
        "price_per_ticket",
        "quantity",
        "splits",
        "listings_in_row",
        "flags",
        "buy_url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Ticket ID (prefixed `tkt_`)."
        },
        "row": {
          "type": [
            "string",
            "null"
          ]
        },
        "price_per_ticket": {
          "description": "Per ticket, all-in.",
          "allOf": [
            {
              "$ref": "#/$defs/Money"
            }
          ]
        },
        "quantity": {
          "type": "integer"
        },
        "splits": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "listings_in_row": {
          "type": "integer"
        },
        "flags": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "obstructed_view",
              "standing_only"
            ]
          }
        },
        "buy_url": {
          "type": "string",
          "format": "uri",
          "description": "XP checkout for this listing."
        }
      }
    },
    "PriceMatrixSection": {
      "type": "object",
      "required": [
        "name",
        "listings",
        "tickets",
        "rows"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "listings": {
          "type": "integer"
        },
        "tickets": {
          "type": "integer"
        },
        "rows": {
          "type": "array",
          "description": "Front row to back.",
          "items": {
            "$ref": "#/$defs/PriceMatrixRow"
          }
        }
      }
    }
  }
}