{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/infersports-dev/json-schema/infersports-dev-compare-lines-result-schema.json",
  "title": "CompareLinesResult",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/infersports-dev-openapi.json#/components/schemas/CompareLinesResult",
  "properties": {
    "event_id": {
      "type": "string",
      "title": "Event Id"
    },
    "home_team": {
      "type": "string",
      "title": "Home Team"
    },
    "away_team": {
      "type": "string",
      "title": "Away Team"
    },
    "market_type": {
      "type": "string",
      "title": "Market Type"
    },
    "period": {
      "type": "string",
      "title": "Period"
    },
    "format": {
      "type": "string",
      "title": "Format"
    },
    "as_of": {
      "type": "string",
      "title": "As Of"
    },
    "stale": {
      "type": "boolean",
      "title": "Stale",
      "description": "True when as_of is older than the freshness window for the match state."
    },
    "consensus_line": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Consensus Line",
      "description": "Line offered by the most books (null for 1x2 / no books)."
    },
    "lines_offered": {
      "items": {
        "type": "number"
      },
      "type": "array",
      "title": "Lines Offered",
      "description": "Distinct lines present across books (AH/totals)."
    },
    "best_prices": {
      "items": {
        "$ref": "#/$defs/BestPrice"
      },
      "type": "array",
      "title": "Best Prices",
      "description": "Best price per outcome on the consensus line (across all returned books)."
    },
    "fair_odds": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "number"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fair Odds",
      "description": "De-vigged fair decimal odds from the sharpest (lowest-overround) book on the consensus line."
    },
    "fair_from": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fair From",
      "description": "Bookmaker key the fair_odds were de-vigged from."
    },
    "books": {
      "items": {
        "$ref": "#/$defs/BookLine"
      },
      "type": "array",
      "title": "Books",
      "description": "Every book's quote for this market, line-by-line. Empty when verbosity='terse' (check book_count for how many books backed the analytics — empty here ≠ no books)."
    },
    "book_count": {
      "type": "integer",
      "title": "Book Count",
      "default": 0
    },
    "summary": {
      "type": "string",
      "title": "Summary",
      "description": "One ready-to-read sentence stating the consensus line, best prices and fair odds (W2) — quote it to the user directly. Present in both verbosity modes.",
      "default": ""
    },
    "verbosity": {
      "type": "string",
      "title": "Verbosity",
      "description": "Echo of the requested verbosity ('full' | 'terse').",
      "default": "full"
    }
  },
  "type": "object",
  "required": [
    "event_id",
    "home_team",
    "away_team",
    "market_type",
    "period",
    "format",
    "as_of",
    "stale"
  ],
  "$defs": {
    "BestPrice": {
      "properties": {
        "outcome": {
          "type": "string",
          "title": "Outcome",
          "description": "home/draw/away (1x2), home/away (AH), or over/under (totals)."
        },
        "bookmaker": {
          "type": "string",
          "title": "Bookmaker"
        },
        "price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "integer"
            }
          ],
          "title": "Price",
          "description": "Best price for this outcome in the requested format."
        },
        "decimal": {
          "type": "number",
          "title": "Decimal",
          "description": "Same price as decimal odds (for comparison)."
        }
      },
      "type": "object",
      "required": [
        "outcome",
        "bookmaker",
        "price",
        "decimal"
      ],
      "title": "BestPrice"
    },
    "BookLine": {
      "properties": {
        "bookmaker": {
          "type": "string",
          "title": "Bookmaker"
        },
        "line": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line",
          "description": "Handicap/total line (null for 1x2)."
        },
        "prices": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              }
            ]
          },
          "type": "object",
          "title": "Prices"
        },
        "overround": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Overround",
          "description": "Book margin = Σ(1/decimal) − 1 over this market's outcomes."
        },
        "status": {
          "type": "string",
          "title": "Status",
          "description": "open | suspended"
        }
      },
      "type": "object",
      "required": [
        "bookmaker",
        "prices",
        "status"
      ],
      "title": "BookLine"
    }
  }
}