{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/carhunt-fr/json-schema/carhunt-fr-listing-analysis-out-schema.json",
  "title": "ListingAnalysisOut",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/carhunt-fr-pro-openapi.json#/components/schemas/ListingAnalysisOut",
  "properties": {
    "listing_id": {
      "type": "string",
      "title": "Listing Id"
    },
    "source_url": {
      "type": "string",
      "title": "Source Url",
      "description": "Lien de l'annonce analysée chez sa source d'origine"
    },
    "current_price": {
      "type": "integer",
      "title": "Current Price",
      "description": "Prix courant de l'annonce analysée, en euros"
    },
    "history_status": {
      "type": "string",
      "title": "History Status",
      "description": "unavailable : aucune observation de prix disponible sur la période demandée ; no_change_recorded : aucune variation enregistrée depuis la première observation ; price_changed : au moins une variation enregistrée. Ne préjuge pas des variations antérieures à la collecte CarHunt."
    },
    "estimate": {
      "$ref": "#/$defs/EstimateOut"
    },
    "price_history": {
      "type": "object",
      "title": "Price History",
      "description": "Historique de cette annonce uniquement, lorsqu'il existe"
    },
    "price_volatility": {
      "type": "object",
      "title": "Price Volatility",
      "description": "Volatilité de cette annonce uniquement, non du marché entier"
    }
  },
  "type": "object",
  "required": [
    "listing_id",
    "source_url",
    "current_price",
    "history_status",
    "estimate",
    "price_history",
    "price_volatility"
  ],
  "$defs": {
    "ComparableOut": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "year": {
          "type": "integer",
          "title": "Year"
        },
        "mileage": {
          "type": "integer",
          "title": "Mileage"
        },
        "price": {
          "type": "integer",
          "title": "Price"
        },
        "source": {
          "type": "string",
          "title": "Source"
        },
        "source_url": {
          "type": "string",
          "title": "Source Url"
        },
        "photo_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Photo Url",
          "description": "URL de consultation de la photo ; aucun droit de reproduction n'est concédé"
        },
        "observed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Observed At",
          "description": "Dernière actualisation connue dans le catalogue"
        }
      },
      "type": "object",
      "required": [
        "id",
        "year",
        "mileage",
        "price",
        "source",
        "source_url"
      ],
      "title": "ComparableOut"
    },
    "EstimateOut": {
      "properties": {
        "generated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Generated At",
          "description": "Date UTC de génération du rapport"
        },
        "make": {
          "type": "string",
          "title": "Make"
        },
        "model": {
          "type": "string",
          "title": "Model"
        },
        "year": {
          "type": "integer",
          "title": "Year"
        },
        "mileage": {
          "type": "integer",
          "title": "Mileage"
        },
        "energy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Energy"
        },
        "gearbox": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Gearbox"
        },
        "motorization": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Motorization"
        },
        "finition": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Finition"
        },
        "year_window": {
          "type": "integer",
          "title": "Year Window",
          "description": "Écart maximal d'année retenu autour de l'année demandée"
        },
        "mileage_window_km": {
          "type": "integer",
          "title": "Mileage Window Km"
        },
        "comparable_count": {
          "type": "integer",
          "title": "Comparable Count",
          "description": "Nombre d'annonces échantillonnées, au plus 2 000"
        },
        "sample_truncated": {
          "type": "boolean",
          "title": "Sample Truncated"
        },
        "good_price": {
          "type": "integer",
          "title": "Good Price",
          "description": "Premier quartile des prix demandés, pas une valeur de transaction"
        },
        "market_median": {
          "type": "integer",
          "title": "Market Median",
          "description": "Médiane des prix demandés"
        },
        "high_price": {
          "type": "integer",
          "title": "High Price",
          "description": "Troisième quartile des prix demandés"
        },
        "comparables": {
          "items": {
            "$ref": "#/$defs/ComparableOut"
          },
          "type": "array",
          "title": "Comparables"
        },
        "negotiation": {
          "anyOf": [
            {
              "$ref": "#/$defs/NegotiationOut"
            },
            {
              "type": "null"
            }
          ]
        },
        "analysis_units_charged": {
          "type": "integer",
          "title": "Analysis Units Charged",
          "default": 1
        },
        "vehicle_units_charged": {
          "type": "integer",
          "title": "Vehicle Units Charged",
          "description": "Les 3 comparables sont inclus dans l'analyse",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "make",
        "model",
        "year",
        "mileage",
        "year_window",
        "mileage_window_km",
        "comparable_count",
        "sample_truncated",
        "good_price",
        "market_median",
        "high_price",
        "comparables"
      ],
      "title": "EstimateOut"
    },
    "NegotiationOut": {
      "properties": {
        "asking_price": {
          "type": "integer",
          "title": "Asking Price"
        },
        "opening_offer": {
          "type": "integer",
          "title": "Opening Offer",
          "description": "Plus petit du prix demandé et du premier quartile observé"
        },
        "target_ceiling": {
          "type": "integer",
          "title": "Target Ceiling",
          "description": "Plus petit du prix demandé et de la médiane observée"
        },
        "difference_to_median": {
          "type": "integer",
          "title": "Difference To Median"
        },
        "basis": {
          "type": "string",
          "title": "Basis",
          "default": "Repère statistique sur les annonces comparables ; état et inspection du véhicule non vérifiés."
        }
      },
      "type": "object",
      "required": [
        "asking_price",
        "opening_offer",
        "target_ceiling",
        "difference_to_median"
      ],
      "title": "NegotiationOut"
    }
  }
}