{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lexio-rent/json-schema/lexio-rent-maintenance-operation-schema.json",
  "title": "MaintenanceOperation",
  "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/MaintenanceOperation",
  "type": "object",
  "properties": {
    "operationCode": {
      "type": "string",
      "minLength": 1,
      "description": "Code stable de l’opération, à citer dans `operationCodes`."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "Libellé de l’opération."
    },
    "group": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "ENGINE",
            "TRANSMISSION",
            "BRAKING",
            "STEERING",
            "SUSPENSION",
            "LIGHTING",
            "TIRES",
            "BODYWORK",
            "INTERIOR",
            "AC",
            "ELECTRONICS",
            "SAFETY",
            "INSPECTION",
            "OTHER",
            "CHECK"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Famille d’opérations ; null si l’opération n’est pas classée."
    },
    "applicability": {
      "type": "object",
      "properties": {
        "families": {
          "minItems": 1,
          "maxItems": 2,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "CAR",
              "TWO_WHEELER"
            ]
          },
          "description": "Familles de véhicules concernées."
        },
        "energies": {
          "minItems": 1,
          "maxItems": 2,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "FUEL",
              "ELECTRIC"
            ]
          },
          "description": "Énergies concernées."
        }
      },
      "required": [
        "families",
        "energies"
      ],
      "description": "Véhicules auxquels l’opération s’applique : la saisir sur un autre véhicule répond 400 `not_applicable`."
    },
    "kmInterval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Intervalle entre deux interventions, en km ; null : aucun."
    },
    "monthInterval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Intervalle entre deux interventions, en mois ; null : aucun."
    },
    "electricKmInterval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Intervalle en km propre aux véhicules électriques ; null : `kmInterval`."
    },
    "electricMonthInterval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Intervalle en mois propre aux véhicules électriques ; null : `monthInterval`."
    },
    "isEnabled": {
      "type": "boolean",
      "description": "false : opération non suivie, sans échéance ; elle reste enregistrable."
    },
    "isCustom": {
      "type": "boolean",
      "description": "true : opération créée par le loueur."
    },
    "isRecordable": {
      "type": "boolean",
      "description": "true : code accepté dans un entretien ; false pour le contrôle technique, saisi dans Lexio."
    },
    "displayOrder": {
      "type": "integer",
      "description": "Rang d’affichage ; ordre de la liste."
    }
  },
  "required": [
    "operationCode",
    "name",
    "group",
    "applicability",
    "kmInterval",
    "monthInterval",
    "electricKmInterval",
    "electricMonthInterval",
    "isEnabled",
    "isCustom",
    "isRecordable",
    "displayOrder"
  ]
}