{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dealermax-app/json-schema/dealermax-app-dealer-public-inventory-detail-response-schema.json",
  "title": "DealerPublicInventoryDetailResponse",
  "description": "Detail envelope for a single inventory item: carries `vehicle` for REWIND/NOS used vehicles or `offer` for NLT rental offers, selected by `service`.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dealermax-app-openapi.json#/components/schemas/DealerPublicInventoryDetailResponse",
  "type": "object",
  "required": [
    "service"
  ],
  "properties": {
    "service": {
      "type": "string",
      "enum": [
        "REWIND",
        "NOS",
        "NLT"
      ],
      "description": "Service the detail belongs to (REWIND, NOS or NLT)."
    },
    "vehicle": {
      "$ref": "#/$defs/DealerPublicVehicleDetail"
    },
    "offer": {
      "$ref": "#/$defs/DealerPublicOfferDetail"
    }
  },
  "oneOf": [
    {
      "required": [
        "service",
        "vehicle"
      ]
    },
    {
      "required": [
        "service",
        "offer"
      ]
    }
  ],
  "$defs": {
    "DealerPublicOfferDetail": {
      "type": "object",
      "additionalProperties": true,
      "description": "Full detail of a single NLT (long-term rental) offer.",
      "required": [
        "id_offerta",
        "marca",
        "modello"
      ],
      "properties": {
        "id_offerta": {
          "type": "integer",
          "description": "NLT offer id."
        },
        "slug": {
          "type": "string",
          "description": "URL-friendly unique slug identifying the offer."
        },
        "marca": {
          "type": "string",
          "description": "Vehicle brand / make."
        },
        "modello": {
          "type": "string",
          "description": "Vehicle model."
        },
        "versione": {
          "type": "string",
          "description": "Trim / version of the model."
        },
        "quotazioni": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          },
          "description": "Monthly-fee quotations across duration×km combinations (each a free-form JSON object)."
        }
      }
    },
    "DealerPublicProfessionalUpfit": {
      "type": "object",
      "additionalProperties": false,
      "description": "One professional body/upfit associated with a VIND industrial vehicle. A non-empty selection contains exactly one primary item.",
      "required": [
        "code",
        "slug",
        "label",
        "display_label",
        "family",
        "is_primary"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable DealerMAX master-data code."
        },
        "slug": {
          "type": "string",
          "description": "Canonical URL/filter slug, for example `gru`."
        },
        "label": {
          "type": "string",
          "description": "Canonical taxonomy label; `Altro` stays one facet."
        },
        "display_label": {
          "type": "string",
          "description": "User-facing label. For `Altro` this is the dealer alias; it never creates a separate facet."
        },
        "family": {
          "type": "string",
          "description": "Display/filter family for the upfit."
        },
        "is_primary": {
          "type": "boolean",
          "description": "True for the single primary upfit of the vehicle."
        }
      }
    },
    "DealerPublicVehicleDetail": {
      "type": "object",
      "additionalProperties": true,
      "description": "Full detail of a single used vehicle (REWIND/NOS).",
      "required": [
        "id_auto",
        "marca",
        "modello"
      ],
      "properties": {
        "id_auto": {
          "type": "string",
          "format": "uuid",
          "description": "Vehicle UUID."
        },
        "marca": {
          "type": "string",
          "description": "Vehicle brand / make."
        },
        "modello": {
          "type": "string",
          "description": "Vehicle model."
        },
        "modello_base": {
          "type": [
            "string",
            "null"
          ],
          "description": "Model family from the Motornet catalog, without generation or series year (e.g. 'Fiorino' for 'Fiorino III 2016', 'Daily' for 'Daily V 70.16 2019'). Null when the catalog has no family for the model. `modello` is unchanged."
        },
        "catalog_type": {
          "type": "string",
          "enum": [
            "auto",
            "vcom",
            "vind",
            "moto"
          ],
          "description": "Authoritative Motornet vehicle catalog: auto (cars), vcom (light commercial), vind (industrial), moto (motorcycles and scooters)."
        },
        "immatricolata_autocarro": {
          "type": "boolean",
          "description": "True when a car (catalog_type 'auto') is registered as an N1 light commercial vehicle. The catalog stays 'auto' — the technical sheet is the car's — but the listing filter treats them as commercial vehicles: catalog_type=vcom selects them, catalog_type=auto does not."
        },
        "quality_program": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": true,
              "required": [
                "slug",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Program id."
                },
                "slug": {
                  "type": "string",
                  "pattern": "^[a-z0-9-]{2,60}$",
                  "description": "Stable program slug; the value accepted by the `program` listing filter."
                },
                "name": {
                  "type": "string",
                  "description": "Program name as shown to end users (e.g. 'Arval AutoSelect')."
                },
                "brand": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Brand the program belongs to, when any (e.g. 'Audi')."
                },
                "claim": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "One-line program claim."
                },
                "logo_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uri",
                  "description": "Program logo URL."
                },
                "warranty_months": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 1,
                  "maximum": 120,
                  "description": "Warranty duration declared by the program, in months."
                },
                "oem_code": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Canonical manufacturer program code, when any."
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Long program description, passed through as stored: allowlist-sanitized HTML (only p, br, strong, b, em, i, ul, ol, li; no attributes; entities only &amp;, &lt;, &gt;) or plain text without markup. Always safe to render as HTML; for a plain-text use, drop the tags and decode the entities."
                },
                "iva_mode": {
                  "type": "string",
                  "enum": [
                    "yes",
                    "no",
                    "unset"
                  ],
                  "description": "VAT display preset of the program: yes, no, or unset (vehicle decides)."
                },
                "max_age_years": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Maximum vehicle age required by the program, in years."
                },
                "max_km": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Maximum mileage required by the program, in km."
                },
                "included_services": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Services included by the program."
                }
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "Quality program of the vehicle with its full public terms (description, requirements, included services), or null."
        },
        "moto_specs": {
          "type": "object",
          "description": "Motorcycle technical sheet, present only when catalog_type is 'moto' and the catalog has data. Flat object; every key is optional and units are in the key name (cm, kg, l, km/h, g/km). For a motorcycle the car body fields (porte, posti, lunghezza, larghezza, altezza, passo, peso, portata, trazione) are null.",
          "properties": {
            "famiglia": {
              "type": "string"
            },
            "categoria": {
              "type": "string"
            },
            "tipo": {
              "type": "string"
            },
            "segmento": {
              "type": "string"
            },
            "cilindrata_cc": {
              "type": "number"
            },
            "cilindri": {
              "type": "number"
            },
            "tempi": {
              "type": "number"
            },
            "raffreddamento": {
              "type": "string"
            },
            "avviamento": {
              "type": "string"
            },
            "trasmissione": {
              "type": "string"
            },
            "marce": {
              "type": "number"
            },
            "abs": {
              "type": "boolean"
            },
            "altezza_sella_cm": {
              "type": "number"
            },
            "altezza_terra_cm": {
              "type": "number"
            },
            "interasse_cm": {
              "type": "number"
            },
            "lunghezza_cm": {
              "type": "number"
            },
            "larghezza_cm": {
              "type": "number"
            },
            "altezza_cm": {
              "type": "number"
            },
            "peso_kg": {
              "type": "number"
            },
            "peso_secco_kg": {
              "type": "number"
            },
            "serbatoio_l": {
              "type": "number"
            },
            "pneumatici_anteriori": {
              "type": "string"
            },
            "pneumatici_posteriori": {
              "type": "string"
            },
            "velocita_max_kmh": {
              "type": "number"
            },
            "euro": {
              "type": "string"
            },
            "emissioni_co2_g_km": {
              "type": "number"
            },
            "consumo_medio": {
              "type": "number"
            }
          }
        },
        "previous_owner_count": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Technical previous-owner count when available. Active used stock is normalized by Core; legacy and historical snapshots may retain zero."
        },
        "previous_owner_count_source": {
          "type": [
            "string",
            "null"
          ],
          "description": "Additive provenance; default_fallback is not verified owner-history evidence."
        },
        "previous_owner_count_is_fallback": {
          "type": "boolean",
          "description": "True only for Core's technical default."
        },
        "professional_upfits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DealerPublicProfessionalUpfit"
          },
          "description": "All public professional upfits on a VIND vehicle."
        },
        "primary_professional_upfit": {
          "anyOf": [
            {
              "$ref": "#/$defs/DealerPublicProfessionalUpfit"
            },
            {
              "type": "null"
            }
          ],
          "description": "Primary professional upfit, when present."
        },
        "ai_content": {
          "type": "object",
          "additionalProperties": true,
          "description": "DealerMAX-generated editorial content for the vehicle (free-form JSON object)."
        },
        "media_urls": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Ordered list of media (image/video) URLs for the vehicle."
        },
        "accessori_serie": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          },
          "description": "Catalogue equipment. Consult equipment_provenance.catalog_series before treating it as an exact Motornet catalogue match; it never proves an installed item on the individual vehicle."
        },
        "equipment_provenance": {
          "type": "object",
          "additionalProperties": true,
          "description": "Source tiers for catalogue rows, inventory declarations and Motornet VIN-linked rows. None is a physical-inspection assertion."
        },
        "accessori_opzionali": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          },
          "description": "Optionals explicitly confirmed for this inventory vehicle. Empty means none selected; the API never falls back to the raw version catalogue."
        },
        "pacchetti": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          },
          "description": "Equipment packages explicitly confirmed for this inventory vehicle. Empty means none selected."
        },
        "accessori_serie_json": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          },
          "description": "Compatibility alias of accessori_serie.",
          "deprecated": true
        },
        "podcast": {
          "type": "object",
          "additionalProperties": true,
          "description": "DealerMAX-generated podcast metadata, if available (free-form JSON object)."
        },
        "video": {
          "type": "object",
          "additionalProperties": true,
          "description": "DealerMAX-generated video metadata, if available (free-form JSON object)."
        },
        "has_podcast": {
          "type": "boolean",
          "description": "True if an audio podcast is available for this vehicle."
        },
        "has_video": {
          "type": "boolean",
          "description": "True if a video is available for this vehicle."
        }
      }
    }
  }
}