{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://autoagentprotocol.org/v0.1/schemas/vehicle.schema.json",
  "title": "Vehicle",
  "description": "Unified vehicle interface used everywhere a vehicle is referenced — inventory results, vehicle_of_interest, and trade_in. The same shape covers both 'a vehicle the buyer wants to purchase' and 'a vehicle the buyer wants to trade in' so buyer agents reuse one type.\n\nField semantics differ by context:\n- For vehicle_of_interest, `condition` MUST be one of `new`, `used`, `cpo`. Pricing fields (`msrp`, `list_price`, `offered_price`, `price`) describe the dealer's listing.\n- For trade_in, `condition` MUST be one of `excellent`, `good`, `fair`, `poor`. Pricing fields are typically absent on the request side and may be populated by the dealer's appraisal response.\n\nContext-dependent constraints (which condition values are valid, which identification fields are required) are enforced at the using request schema (e.g. `lead.submit.request`).\n\nNo fields are required at this base schema. `additionalProperties: true` allows inventory.vehicle responses to carry richer dealer-specific fields (drivetrain, fuel, photos, VDP URL, etc.) without schema changes.",
  "type": "object",
  "properties": {
    "vin": {
      "type": "string",
      "pattern": "^[A-HJ-NPR-Z0-9]{17}$",
      "description": "Vehicle Identification Number (17 chars, ISO 3779). Optional on trade-ins; recommended on inventory listings of used vehicles."
    },
    "year": {
      "type": "integer",
      "minimum": 1900,
      "maximum": 2100,
      "description": "Model year (e.g. 2024)."
    },
    "make": {
      "type": "string",
      "description": "Vehicle make / manufacturer brand (e.g. 'Honda', 'BMW', 'Ford')."
    },
    "model": {
      "type": "string",
      "description": "Vehicle model name (e.g. 'CR-V', '3 Series', 'F-150')."
    },
    "trim": {
      "type": "string",
      "description": "Trim level (e.g. 'EX-L', 'M Sport', 'Lariat')."
    },
    "condition": {
      "type": "string",
      "enum": ["new", "used", "cpo", "excellent", "good", "fair", "poor"],
      "description": "Combined condition enum spanning both sale-condition and trade-in-condition vocabularies. For vehicle_of_interest use one of `new` | `used` | `cpo` (Certified Pre-Owned). For trade_in use one of `excellent` | `good` | `fair` | `poor`. The using request schema enforces the correct subset by context."
    },
    "msrp": {
      "$ref": "./_primitives/money.schema.json",
      "description": "Manufacturer's Suggested Retail Price (sticker price). Inventory context."
    },
    "price": {
      "$ref": "./_primitives/money.schema.json",
      "description": "FTC-emphasized FINAL out-the-door price after all incentives, mandatory fees, and required add-ons. Per FTC enforcement (CARS Rule), this field MUST reflect the total amount the buyer would pay; advertising a 'price' that excludes required fees or omits required add-ons is a violation. Inventory context."
    },
    "list_price": {
      "$ref": "./_primitives/money.schema.json",
      "description": "Dealer's advertised list price; the base price BEFORE incentives, taxes, or fees. Inventory context."
    },
    "offered_price": {
      "$ref": "./_primitives/money.schema.json",
      "description": "Regional price equal to list_price plus applicable taxes for the buyer's `zip`, when the dealer enables desking. Present only if a `zip` is supplied AND the dealer supports regional pricing. Inventory context."
    },
    "zip": {
      "type": "string",
      "pattern": "^\\d{5}(-\\d{4})?$",
      "description": "Buyer ZIP code used to compute regional pricing fields (`offered_price`). US ZIP, 5 digits or ZIP+4. Optional; when absent, regional pricing fields MUST be omitted."
    },
    "stock": {
      "type": "string",
      "description": "Dealer's stock number for this unit. Inventory and vehicle_of_interest contexts."
    },
    "mileage": {
      "type": "integer",
      "minimum": 0,
      "description": "Odometer reading in miles. Required for trade-ins; typical on used inventory."
    },
    "body": {
      "type": "string",
      "description": "Body style as text (e.g. 'sedan', 'suv', 'truck', 'coupe', 'hatchback', 'wagon', 'minivan', 'convertible')."
    },
    "transmission": {
      "type": "string",
      "description": "Transmission type as text (e.g. 'automatic', 'manual', '8-speed automatic', 'cvt')."
    }
  },
  "additionalProperties": true
}
