{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cardealscore-com/json-schema/cardealscore-com-quote-report-schema.json",
  "title": "QuoteReport",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cardealscore-com-openapi.json#/components/schemas/QuoteReport",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "grade",
    "price_band",
    "flags",
    "pushback",
    "vehicle"
  ],
  "properties": {
    "grade": {
      "enum": [
        "A",
        "B",
        "C",
        "D",
        "E",
        "F"
      ]
    },
    "price_band": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "position",
        "selling_price",
        "msrp",
        "invoice",
        "vs_msrp",
        "vs_invoice",
        "summary"
      ],
      "properties": {
        "position": {
          "enum": [
            "at_or_below_invoice",
            "below_msrp",
            "at_msrp",
            "above_msrp"
          ]
        },
        "selling_price": {
          "type": "number"
        },
        "msrp": {
          "type": "number"
        },
        "invoice": {
          "type": [
            "number",
            "null"
          ]
        },
        "vs_msrp": {
          "type": "number",
          "description": "selling_price minus msrp. Negative is under MSRP."
        },
        "vs_invoice": {
          "type": [
            "number",
            "null"
          ]
        },
        "summary": {
          "type": "string"
        }
      }
    },
    "flags": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "line",
          "amount",
          "severity",
          "ask"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "line": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          },
          "severity": {
            "enum": [
              "flag",
              "red"
            ]
          },
          "ask": {
            "type": "string"
          }
        }
      }
    },
    "pushback": {
      "type": "array",
      "maxItems": 5,
      "items": {
        "type": "string"
      },
      "description": "Sentences to send the dealer. Empty when nothing is flagged."
    },
    "vehicle": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "year",
        "make",
        "model",
        "trim",
        "vin_prefix"
      ],
      "properties": {
        "year": {
          "type": [
            "integer",
            "null"
          ]
        },
        "make": {
          "type": [
            "string",
            "null"
          ]
        },
        "model": {
          "type": [
            "string",
            "null"
          ]
        },
        "trim": {
          "type": [
            "string",
            "null"
          ]
        },
        "vin_prefix": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[A-HJ-NPR-Z0-9]{9}$",
          "description": "The first 9 characters of the VIN. Never the full VIN."
        }
      }
    }
  }
}