openapi: 3.1.0
info:
  title: Segment
  version: 2.0.0
  description: Schema definition for the Segment entity in the Beckn Mobility domain.
  license:
    name: CC-BY-NC-SA 4.0 International
    url: https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en
  contact:
    name: Beckn Labs
    url: https://beckn.io
components:
  schemas:
    Segment:
      x-iri: https://schema.nfh.global/Segment/v2.0
      type: object
      title: Segment
      description: A portion of a rail journey operated continuously by a single carrier
        between two consecutive stops or stations.
      x-tags:
        - mobility
        - ride-hailing
      properties:
        carrierCode:
          description: Code of the carrier operating this segment
          type: string
        segmentNumber:
          description: Sequence number of this segment within the journey
          type: number
        trainNumber:
          description: Train or service number for this segment
          type: string
        coachNumber:
          description: Coach or carriage number
          type: string
        mode:
          description: Transport mode for this leg (e.g. BUS, RAIL, WALK, BICYCLE)
          type: string
        origin:
          description: Start location of the leg
          $ref: https://schema.nfh.global/Location/v2.0/attributes.yaml#/components/schemas/Location
        destination:
          description: End location of the leg
          $ref: https://schema.nfh.global/Location/v2.0/attributes.yaml#/components/schemas/Location
        startTime:
          description: Scheduled or actual start time of the leg
          type: string
          format: date-time
        endTime:
          description: Scheduled or actual end time of the leg
          type: string
          format: date-time
        distance:
          description: Distance of this leg in metres
          type: number
        headsign:
          description: Destination sign text displayed on the vehicle
          type: string
        routeRef:
          description: Reference to the route served on this leg
          $ref: https://schema.nfh.global/Route/v2.0/attributes.yaml#/components/schemas/Route
      additionalProperties: false
