{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/marinetraffic/refs/heads/main/json-schema/marinetraffic-vessel-schema.json",
  "title": "MarineTraffic Vessel",
  "description": "AIS vessel position and static data record from MarineTraffic",
  "type": "object",
  "properties": {
    "MMSI": {
      "type": "string",
      "description": "Maritime Mobile Service Identity (9 digits)",
      "pattern": "^[0-9]{9}$"
    },
    "IMO": {
      "type": ["integer", "null"],
      "description": "IMO number (7 digits)"
    },
    "SHIP_ID": {
      "type": "integer",
      "description": "MarineTraffic internal vessel identifier"
    },
    "LAT": {
      "type": "number",
      "format": "double",
      "minimum": -90,
      "maximum": 90,
      "description": "Latitude in decimal degrees (WGS84)"
    },
    "LON": {
      "type": "number",
      "format": "double",
      "minimum": -180,
      "maximum": 180,
      "description": "Longitude in decimal degrees (WGS84)"
    },
    "SPEED": {
      "type": "number",
      "minimum": 0,
      "description": "Speed over ground in tenths of knots"
    },
    "HEADING": {
      "type": "integer",
      "minimum": 0,
      "maximum": 511,
      "description": "True heading 0-359; 511 = not available"
    },
    "COURSE": {
      "type": "number",
      "minimum": 0,
      "maximum": 360,
      "description": "Course over ground in tenths of degrees"
    },
    "STATUS": {
      "type": "integer",
      "minimum": 0,
      "maximum": 15,
      "description": "AIS navigational status (0=Under way using engine, 1=At anchor, etc.)"
    },
    "TIMESTAMP": {
      "type": "string",
      "format": "date-time",
      "description": "UTC timestamp of the AIS position report"
    },
    "DSRC": {
      "type": "string",
      "enum": ["TER", "SAT"],
      "description": "Data source: TER = terrestrial AIS, SAT = satellite AIS"
    },
    "VESSEL_NAME": {
      "type": "string",
      "maxLength": 20
    },
    "CALLSIGN": {
      "type": "string",
      "maxLength": 7
    },
    "FLAG": {
      "type": "string",
      "description": "Flag state country code (ISO 3166-1 alpha-2)"
    },
    "SHIPTYPE": {
      "type": "integer",
      "minimum": 0,
      "maximum": 99,
      "description": "AIS vessel type code per ITU-R M.1371"
    },
    "CARGO": {
      "type": "integer",
      "description": "Cargo type code from AIS message type 5"
    },
    "CURRENT_PORT": {
      "type": "string"
    },
    "LAST_PORT": {
      "type": "string"
    },
    "NEXT_PORT_NAME": {
      "type": "string"
    },
    "NEXT_PORT_UNLOCODE": {
      "type": "string",
      "description": "UN/LOCODE of the destination port"
    },
    "ETA": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "Estimated time of arrival at destination"
    },
    "DESTINATION": {
      "type": "string",
      "maxLength": 20,
      "description": "Voyage destination as broadcast in AIS"
    },
    "LENGTH": {
      "type": "integer",
      "minimum": 0,
      "description": "Length overall in meters"
    },
    "WIDTH": {
      "type": "integer",
      "minimum": 0,
      "description": "Beam/width in meters"
    },
    "DRAUGHT": {
      "type": "number",
      "minimum": 0,
      "description": "Current static draught in tenths of meters"
    },
    "GT": {
      "type": "integer",
      "minimum": 0,
      "description": "Gross tonnage"
    },
    "DWT": {
      "type": "integer",
      "minimum": 0,
      "description": "Deadweight tonnage"
    },
    "YEAR_BUILT": {
      "type": ["integer", "null"],
      "minimum": 1800,
      "maximum": 2100
    }
  },
  "required": ["MMSI", "LAT", "LON", "TIMESTAMP"]
}
