{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "One transport segment of a trip — a single origin-to-destination movement. Legs of a trip are grouped by a social.passports.folio.",
      "key": "tid",
      "record": {
        "properties": {
          "carrier": {
            "description": "Carrier name, e.g. 'Japan Airlines' or 'Amtrak'.",
            "maxLength": 100,
            "type": "string"
          },
          "carrierCode": {
            "description": "Transport-agnostic carrier code — IATA airline code for flights (e.g. 'JL'), route abbreviation for non-IATA carriers (e.g. 'ACE' for Acela).",
            "maxLength": 10,
            "type": "string"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "destination": {
            "description": "Inline destination place object. Self-contained — no external fetch required.",
            "ref": "social.passports.place",
            "type": "ref"
          },
          "destinationTransportCode": {
            "description": "Terminal code at destination — IATA airport code for flights (e.g. 'CDG'), station code for rail, etc. Overrides the place record's transport_code for this specific leg.",
            "maxLength": 10,
            "type": "string"
          },
          "endDate": {
            "description": "Arrival date in YYYY-MM-DD format.",
            "maxLength": 10,
            "type": "string"
          },
          "note": {
            "description": "The user's note about this leg.",
            "maxLength": 3000,
            "type": "string"
          },
          "origin": {
            "description": "Inline origin place object. Self-contained — no external fetch required.",
            "ref": "social.passports.place",
            "type": "ref"
          },
          "originTransportCode": {
            "description": "Terminal code at origin — IATA airport code for flights (e.g. 'JFK'), station code for rail (e.g. 'NYP'), etc. Overrides the place record's transport_code for this specific leg.",
            "maxLength": 10,
            "type": "string"
          },
          "serviceNumber": {
            "description": "Flight number, train number, or equivalent service identifier, e.g. 'JL006' or 'Acela 2151'.",
            "maxLength": 20,
            "type": "string"
          },
          "startDate": {
            "description": "Departure date in YYYY-MM-DD format. Stored as a date string rather than datetime to avoid timezone ambiguity — travel dates are calendar-day concepts.",
            "maxLength": 10,
            "type": "string"
          },
          "transportation": {
            "description": "Mode of transportation.",
            "knownValues": [
              "flight",
              "train",
              "bus",
              "car",
              "ferry",
              "walking",
              "cycling",
              "other"
            ],
            "type": "string"
          }
        },
        "required": [
          "origin",
          "destination",
          "transportation",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "social.passports.travel.leg",
  "lexicon": 1
}
