{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "1.0"
    },
    "eventId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "connectionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "storeId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "occurredAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "vehicle": {
      "type": "object",
      "properties": {
        "externalId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 150
        },
        "make": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "model": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "version": {
          "default": "",
          "type": "string",
          "maxLength": 160
        },
        "manufactureYear": {
          "type": "integer",
          "minimum": 1950,
          "maximum": 2027
        },
        "modelYear": {
          "type": "integer",
          "minimum": 1950,
          "maximum": 2028
        },
        "amountInCents": {
          "type": "string",
          "pattern": "^\\d+$"
        },
        "mileageKm": {
          "type": "integer",
          "minimum": 0,
          "maximum": 5000000
        },
        "bodyType": {
          "type": "string",
          "enum": [
            "SUV",
            "SEDAN",
            "HATCHBACK",
            "PICKUP",
            "VAN",
            "SPORT",
            "OTHER",
            "MOTORCYCLE",
            "TRUCK",
            "BOAT"
          ]
        },
        "fuel": {
          "type": "string",
          "enum": ["FLEX", "GASOLINE", "DIESEL", "ETHANOL", "ELECTRIC", "HYBRID", "CNG"]
        },
        "transmission": {
          "type": "string",
          "enum": ["MANUAL", "AUTOMATIC", "NONE"]
        },
        "color": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 60
            },
            {
              "type": "null"
            }
          ]
        },
        "doors": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 2,
              "maximum": 6
            },
            {
              "type": "null"
            }
          ]
        },
        "engine": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 80
            },
            {
              "type": "null"
            }
          ]
        },
        "usageHours": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000
            },
            {
              "type": "null"
            }
          ]
        },
        "lengthFeet": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 5,
              "maximum": 300
            },
            {
              "type": "null"
            }
          ]
        },
        "plateEnding": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d$"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 5000
            },
            {
              "type": "null"
            }
          ]
        },
        "features": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 3000
            },
            {
              "type": "null"
            }
          ]
        },
        "conditions": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 80
                  }
                },
                {
                  "type": "string",
                  "maxLength": 600
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "photos": {
          "default": [],
          "maxItems": 30,
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "videoUrl": {
          "type": ["string", "null"]
        },
        "sourceUrl": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000,
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "availability": {
          "type": "string",
          "enum": ["AVAILABLE", "SOLD", "UNAVAILABLE"]
        },
        "sourceVersion": {
          "type": "string",
          "pattern": "^\\d+$"
        }
      },
      "required": [
        "externalId",
        "make",
        "model",
        "manufactureYear",
        "modelYear",
        "amountInCents",
        "mileageKm",
        "bodyType",
        "fuel",
        "transmission",
        "availability",
        "sourceVersion"
      ]
    }
  },
  "required": ["schemaVersion", "eventId", "connectionId", "storeId", "occurredAt", "vehicle"]
}
