{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fleetkeep-co-uk/json-schema/fleetkeep-co-uk-defect-list-schema.json",
  "title": "DefectList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fleetkeep-co-uk-defects-api-openapi.yml#/components/schemas/DefectList",
  "type": "object",
  "required": [
    "open",
    "recent"
  ],
  "properties": {
    "open": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DefectEvent"
      }
    },
    "recent": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DefectEvent"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "DefectEvent": {
      "type": "object",
      "required": [
        "id",
        "vehicleId",
        "registration",
        "vehicleLabel",
        "title",
        "notes",
        "priority",
        "reportedBy",
        "followUpAction",
        "status",
        "completedAt",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "vehicleId": {
          "type": "string",
          "format": "uuid"
        },
        "registration": {
          "type": "string"
        },
        "vehicleLabel": {
          "type": [
            "string",
            "null"
          ]
        },
        "title": {
          "type": "string"
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "priority": {
          "type": "string",
          "enum": [
            "low",
            "normal",
            "high",
            "safety_critical"
          ]
        },
        "reportedBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "followUpAction": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "open",
            "completed"
          ]
        },
        "completedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "additionalProperties": false
    }
  }
}