{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lexio-rent/json-schema/lexio-rent-maintenance-alert-schema.json",
  "title": "MaintenanceAlert",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lexio-rent-entretien-api-openapi.yml#/components/schemas/MaintenanceAlert",
  "type": "object",
  "properties": {
    "operationCode": {
      "type": "string",
      "minLength": 1,
      "description": "Opération concernée (`GET /maintenance-operations`)."
    },
    "status": {
      "type": "string",
      "enum": [
        "OVERDUE",
        "UPCOMING",
        "OK"
      ],
      "description": "`OVERDUE` : `remainingKm` ou `remainingDays` négatif. `UPCOMING` : moins de 1000 km ou de 30 jours restants. `OK` sinon."
    },
    "isBlockingRentals": {
      "type": "boolean",
      "description": "true si cette opération, en retard, rend le véhicule non réservable (selon le réglage de blocage du loueur) ; aussi sur `CT_INSPECTION` quand un contrôle technique échoué attend sa contre-visite."
    },
    "kmInterval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Intervalle effectif pour ce véhicule, en km ; null : pas d’échéance kilométrique."
    },
    "monthInterval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Intervalle effectif pour ce véhicule, en mois ; null : pas d’échéance de date."
    },
    "hasHistory": {
      "type": "boolean",
      "description": "false : aucune intervention enregistrée, l’échéance part du début du suivi."
    },
    "lastServiceDate": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "description": "Jour de la dernière intervention enregistrée ; null sans historique."
    },
    "lastServiceOdometerKm": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Kilométrage de la dernière intervention ; null sans historique."
    },
    "dueOdometerKm": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Kilométrage d’échéance ; null sans intervalle en km."
    },
    "dueDate": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "description": "Jour d’échéance ; null sans intervalle en mois."
    },
    "remainingKm": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Kilomètres restants depuis le compteur actuel ; négatif : échéance dépassée."
    },
    "remainingDays": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Jours restants ; négatif : échéance dépassée."
    }
  },
  "required": [
    "operationCode",
    "status",
    "isBlockingRentals",
    "kmInterval",
    "monthInterval",
    "hasHistory",
    "lastServiceDate",
    "lastServiceOdometerKm",
    "dueOdometerKm",
    "dueDate",
    "remainingKm",
    "remainingDays"
  ]
}