asyncapi: 3.0.0
info:
    title: PID
    version: 1.0.0
    description: PID
channels:
    jis.fetchJISEvents:
        address: vehicle-positions.jis.fetchJISEvents
        description: Fetch JIS events from data source
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    jis.fetchJISInfotexts:
        address: vehicle-positions.jis.fetchJISInfotexts
        description: Fetch JIS infotexts from data source
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    jis.refreshJISEvents:
        address: vehicle-positions.jis.refreshJISEvents
        description: Refresh JIS events in database
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            data:
                payload:
                    type: object
                    properties:
                        data:
                          $ref: "#/components/schemas/JISEvent"
                        shouldTriggerWebhooks:
                            type: boolean
                            default:
                              - false
                            examples:
                              - true
                    required:
                      - data

    jis.refreshJISInfotexts:
        address: vehicle-positions.jis.refreshJISInfotexts
        description: Refresh JIS infotexts in database
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            data:
                $ref: "#/components/messages/JISInfotexts"
    jis.refreshJISInfotextsCache:
        address: vehicle-positions.jis.refreshJISInfotextsCache
        description: Refresh JIS infotexts cache in Redis (Valkey)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    jis.updateEventWebhook:
        description: post updated events to predefined websites
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        address: vehicle-positions.jis.updateEventWebhook
        messages:
            data:
                $ref: "#/components/messages/JISEvents"
    ropidgtfs.refreshPublicGtfsDepartureCache:
        address: vehicle-positions.ropidgtfs.refreshPublicGtfsDepartureCache
        description: Refresh PublicGtfsDepartureCache
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    ropidgtfs.refreshGtfsStopsCache:
        address: vehicle-positions.ropidgtfs.refreshGtfsStopsCache
        description: Refresh GtfsStopsCache
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    ropidgtfs.refreshGtfsTripStopsCache:
        address: vehicle-positions.ropidgtfs.refreshGtfsTripStopsCache
        description: Refresh GtfsTripStopsCache — pre-computed trip stop sequences for transfer board line-direction filtering
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    ropidgtfs.ensureCache:
        address: vehicle-positions.ropidgtfs.ensureCache
        description: Triggers all cache refreshes to ensure caches are populated and up to date
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    updateGTFSTripId:
        address: vehicle-positions.vehiclepositions.updateGTFSTripId
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        messages:
            data:
                $ref: "#/components/messages/updateGTFSTripId"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    updateRunsGTFSTripId:
        address: vehicle-positions.vehiclepositions.updateRunsGTFSTripId
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        messages:
            data:
                $ref: "#/components/messages/IUpdateRunsGtfsTripInput"
    updateDelay:
        address: vehicle-positions.vehiclepositions.updateDelay
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        messages:
            data:
                $ref: "#/components/messages/IUpdateDelayInput"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    saveDataToDB:
        address: vehicle-positions.vehiclepositions.saveDataToDB
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        messages:
            data:
                $ref: "#/components/messages/IMpvMessageInput"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    refreshPublicTripCache:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.refreshPublicTripCache
        messages:
            empty:
                $ref: "#/components/messages/EmptyObject"
    refreshPublicStopTimeCache:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.refreshPublicStopTimeCache
        messages:
            empty:
                $ref: "#/components/messages/EmptyObject"
    refreshGTFSTripData:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.refreshGTFSTripData
        messages:
            empty:
                $ref: "#/components/messages/EmptyObject"
    propagateTrainDelay:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.propagateTrainDelay
        messages:
            input:
                $ref: "#/components/messages/IPropagateTrainDelayInput"
    propagateDelay:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.propagateDelay
        messages:
            data:
                $ref: "#/components/messages/propagateDelay"
    processRegionalBusPositions:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.processRegionalBusPositions
        messages:
            data:
                $ref: "#/components/messages/IUpdateDelayInput"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    dataRetention:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.dataretention.deleteData
        messages:
            empty:
                $ref: "#/components/messages/EmptyObject"
    saveTramRunsToDB:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositions.saveTramRunsToDB
        messages:
            data:
                $ref: "#/components/messages/saveTramRunsToDB"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    saveMetroRunsToDB:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositionsruns.saveMetroRunsToDB
        messages:
            data:
                $ref: "#/components/messages/saveMetroRunsToDB"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    saveBusRunsToDB:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositionsruns.saveBusRunsToDB
        messages:
            data:
                $ref: "#/components/messages/saveBusRunsToDB"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    saveArrivaCityRunsToDB:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: ehicle-positions.vehiclepositionsruns.saveArrivaCityRunsToDB
        messages:
            data:
                $ref: "#/components/messages/saveArrivaCityRunsToDB"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    processMetroRunMessages:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositionsruns.processMetroRunMessages
        messages:
            data:
                $ref: "#/components/messages/processMetroRunMessages"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    processRegionalBusRunMessages:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositionsruns.processRegionalBusRunMessages
        messages:
            data:
                $ref: "#/components/messages/processRegionalBusRunMessages"
            messageProperties:
                $ref: "#/components/messages/messageProperties"
    generateFiles:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehiclepositionsgtfsrt.generateFiles
        messages:
            empty:
                $ref: "#/components/messages/EmptyObject"
    refreshDescriptors:
        description: some description
        bindings:
            amqp:
                is: queue
                queue:
                    exclusive: true
        address: vehicle-positions.vehicledescriptors.refreshDescriptors
        messages:
            empty:
                $ref: "#/components/messages/EmptyObject"
operations:
    jis.fetchJISEvents:
        action: "send"
        channel:
            $ref: "#/channels/jis.fetchJISEvents"
    jis.fetchJISInfotexts:
        action: "send"
        channel:
            $ref: "#/channels/jis.fetchJISInfotexts"
    jis.refreshJISEvents:
        action: "send"
        channel:
            $ref: "#/channels/jis.refreshJISEvents"
    jis.refreshJISInfotexts:
        action: "send"
        channel:
            $ref: "#/channels/jis.refreshJISInfotexts"
    jis.refreshJISInfotextsCache:
        action: "send"
        channel:
            $ref: "#/channels/jis.refreshJISInfotextsCache"
    jis.updateEventWebhook:
        action: "send"
        channel:
            $ref: "#/channels/jis.updateEventWebhook"
    ropidgtfs.refreshPublicGtfsDepartureCache:
        action: "send"
        channel:
            $ref: "#/channels/ropidgtfs.refreshPublicGtfsDepartureCache"
    ropidgtfs.refreshGtfsStopsCache:
        action: "send"
        channel:
            $ref: "#/channels/ropidgtfs.refreshGtfsStopsCache"
    ropidgtfs.refreshGtfsTripStopsCache:
        action: "send"
        channel:
            $ref: "#/channels/ropidgtfs.refreshGtfsTripStopsCache"
    updateGTFSTripId:
        action: "send"
        channel:
            $ref: "#/channels/updateGTFSTripId"
    refreshDescriptors:
        action: "send"
        channel:
            $ref: "#/channels/refreshDescriptors"
    generateFiles:
        action: "send"
        channel:
            $ref: "#/channels/generateFiles"
    processRegionalBusRunMessages:
        action: "send"
        channel:
            $ref: "#/channels/processRegionalBusRunMessages"
    updateRunsGTFSTripId:
        action: "send"
        channel:
            $ref: "#/channels/updateRunsGTFSTripId"
    updateDelay:
        action: "send"
        channel:
            $ref: "#/channels/updateDelay"
    saveDataToDB:
        action: "send"
        channel:
            $ref: "#/channels/saveDataToDB"
    refreshPublicTripCache:
        action: "send"
        channel:
            $ref: "#/channels/refreshPublicTripCache"
    refreshPublicStopTimeCache:
        action: "send"
        channel:
            $ref: "#/channels/refreshPublicStopTimeCache"
    refreshGTFSTripData:
        action: "send"
        channel:
            $ref: "#/channels/refreshGTFSTripData"
    propagateTrainDelay:
        action: "send"
        channel:
            $ref: "#/channels/propagateTrainDelay"
    propagateDelay:
        action: "send"
        channel:
            $ref: "#/channels/propagateDelay"
    processRegionalBusPositions:
        action: "send"
        channel:
            $ref: "#/channels/processRegionalBusPositions"
    dataRetention:
        action: "send"
        channel:
            $ref: "#/channels/dataRetention"
    saveTramRunsToDB:
        action: "send"
        channel:
            $ref: "#/channels/saveTramRunsToDB"
    saveMetroRunsToDB:
        action: "send"
        channel:
            $ref: "#/channels/saveMetroRunsToDB"
    saveBusRunsToDB:
        action: "send"
        channel:
            $ref: "#/channels/saveBusRunsToDB"
    saveArrivaCityRunsToDB:
        action: "send"
        channel:
            $ref: "#/channels/saveArrivaCityRunsToDB"
    processMetroRunMessages:
        action: "send"
        channel:
            $ref: "#/channels/processMetroRunMessages"
components:
    messages:
        emptyMessage:
            title: Empty message
        saveTramRunsToDB:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/ICommonRunsInput"
        processMetroRunMessages:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/IProcessMetroRunsMessagesInput"
        processRegionalBusRunMessages:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/IProcessRegionalBusRunMessagesInput"
        saveArrivaCityRunsToDB:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/IRegionalBusRunsInput"
        saveBusRunsToDB:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/ICommonRunsInput"
        saveMetroRunsToDB:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/IMetroRunsInput"
        propagateDelay:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/IPropagateDelayInput"
        IPropagateTrainDelayInput:
            payload:
                type: object
                properties:
                    data:
                        type: object
                        $ref: "#/components/schemas/ITripPositionTuple"
        EmptyObject:
            payload:
                type: object
        IMpvMessageInput:
            payload:
                type: object
                properties:
                    m:
                        type: object
                        $ref: "#/components/schemas/IMpvMessageContent"
        updateGTFSTripId:
            payload:
                type: object
                properties:
                    positions:
                        type: array
                        $ref: "#/components/schemas/IPositionTransformationResult"
                    trips:
                        type: array
                        $ref: "#/components/schemas/IUpdateGTFSTripIdData"
        messageProperties:
            payload:
                type: object
                properties:
                    positions:
                        type: array
                        items:
                            type: object
                            properties:
                                trips_id:
                                    type: string
                    trips:
                        type: array
                        $ref: "#/components/schemas/IUpdateGTFSTripIdData"
        IUpdateRunsGtfsTripInput:
            payload:
                type: object
                properties:
                    run:
                        type: object
                        $ref: "#/components/schemas/ICommonRunsModel"
                    run_message:
                        type: object
                        $ref: "#/components/schemas/ICommonRunsMessagesModel"
                    isNotPublic:
                        type: boolean
                        description: Flag indicating if this is a not-public vehicle (e.g., replacement bus/tram). Optional.
                    notPublicVehicleRouteType:
                        type: number
                        enum: [0, 3]
                        description: GTFS route type for not-public vehicles (0=tram, 3=bus). Only populated when isNotPublic is true. Used to determine correct vehicle type mapping.
        IUpdateDelayInput:
            payload:
                type: object
                properties:
                    updatedTrips:
                        type: array
                        items:
                            oneOf:
                                - $ref: "#/components/schemas/IUpdateDelayTripsIdsData"
                                - $ref: "#/components/schemas/IUpdateDelayRunTripsData"
                    positions:
                        type: array
                        items:
                            $ref: "#/components/schemas/IPositionTransformationResult"
                    schedule:
                        type: array
                        items:
                            $ref: "#/components/schemas/IScheduleDto"
        JISEvents:
            payload:
                type: array
                items:
                    $ref: "#/components/schemas/JISEvent"
        JISInfotexts:
            payload:
                type: array
                items:
                    $ref: "#/components/schemas/JISInfotext"

    schemas:
        IUpdateGTFSTripIdData:
            type: object
            properties:
                cis_line_short_name:
                  type: [string, "null"]
                id:
                  type: [string]
                start_asw_stop_id:
                  type: [string, "null"]
                start_cis_stop_id:
                  type: [integer, "null"]
                start_cis_stop_platform_code:
                  type: [string, "null"]
                start_timestamp:
                  type: [string, "null"]
                  format: date-time
                agency_name_real:
                  type: [string, "null"]
                agency_name_scheduled:
                  type: [string, "null"]
                cis_line_id:
                  type: [string, "null"]
                cis_trip_number:
                  type: [integer, "null"]
                origin_route_name:
                  type: [string, "null"]
                run_number:
                  type: [integer, "null"]
                start_time:
                  type: [string, "null"]
                vehicle_registration_number:
                  type: [integer, "null"]
                vehicle_type_id:
                  type: [integer, "null"]
                wheelchair_accessible:
                  type: [boolean, "null"]
        IPositionTransformationResult:
            type: object
            properties:
                asw_last_stop_id:
                    type: string
                    nullable: true
                bearing:
                    type: number
                    nullable: true
                cis_last_stop_id:
                    type: number
                    nullable: true
                cis_last_stop_sequence:
                    type: number
                    nullable: true
                delay_stop_arrival:
                    type: number
                    nullable: true
                delay_stop_departure:
                    type: number
                    nullable: true
                is_canceled:
                    type: boolean
                lat:
                    type: number
                    nullable: true
                lng:
                    type: number
                    nullable: true
                origin_time:
                    type: string
                origin_timestamp:
                    type: string
                    format: date-time
                speed:
                    type: number
                    nullable: true
                state_position:
                    type: string
                    enum:
                        [
                            off_track,
                            at_stop,
                            on_track,
                            before_track,
                            after_track,
                            canceled,
                            invisible,
                            unknown,
                            before_track_delayed,
                            duplicate,
                            mismatched,
                            not_public,
                        ]
                state_process:
                    type: string
                    enum: [tcp_input, udp_input, input, processed]
                is_tracked:
                    type: boolean
                    nullable: true
                trips_id:
                    type: string
            required:
                - is_canceled
                - origin_time
                - origin_timestamp
                - state_position
                - state_process
                - trips_id
        ICommonRunsModel:
            type: object
            properties:
                id:
                    type: string
                    description: The unique identifier of the run.
                route_id:
                    type: string
                    description: The ID of the route.
                run_number:
                    type: number
                    description: The number of the run.
                line_short_name:
                    type: string
                    description: The short name of the line.
                registration_number:
                    type: string
                    description: The registration number of the vehicle.
                msg_start_timestamp:
                    type: string
                    description: The timestamp when the message was first sent.
                msg_last_timestamp:
                    type: string
                    description: The timestamp when the message was last sent.
                wheelchair_accessible:
                    type: [boolean, "null"]
                    description: |
                        Raw wheelchair accessibility flag from vehiclepositions_trips.
                        Mapped to wheelchairAccessible proto enum in GTFS-RT VehicleDescriptor:
                        null → WHEELCHAIR_ACCESSIBLE_UNSPECIFIED (0), true → WHEELCHAIR_ACCESSIBLE (1), false → WHEELCHAIR_INACCESSIBLE (2).
                        The OVAPI extension .transit_realtime.ovapiVehicleDescriptor.wheelchairAccessible retains the raw boolean/null value alongside the standard field.
        ICommonRunsMessagesModel:
            type: object
            properties:
                id:
                    type: number
                    description: Autoincrement ID
                runs_id:
                    type: string
                    description: Associated foreign key
                lat:
                    type: number
                    description: Latitude
                lng:
                    type: number
                    description: Longitude
                actual_stop_asw_id:
                    type: string
                    description: Actual stop ASW ID
                actual_stop_timestamp_real:
                    type: string
                    format: date-time
                    description: >
                        Transmission time of the message (derived from tm). Corresponds to the
                        lat/lng position reported in the same message.
                actual_stop_timestamp_scheduled:
                    type: string
                    format: date-time
                    nullable: true
                    description: Actual stop timestamp (scheduled)
                last_stop_asw_id:
                    type: string
                    description: Last stop ASW ID
                packet_number:
                    type: string
                    description: Packet number
                msg_timestamp:
                    type: string
                    format: date-time
                    description: >
                        Actual event time at the stop (derived from takt). Used for delay
                        calculation.
                events:
                    type: string
                    enum: [P, O, V, T]
                    description: TCP events
        IScheduleDto:
            type: object
            properties:
                trip_id:
                    type: string
                service_id:
                    type: string
                direction_id:
                    type: number
                    nullable: true
                shape_id:
                    type: string
                    nullable: true
                date:
                    type: string
                route_id:
                    type: string
                route_type:
                    type: number
                    enum: [0, 1, 2, 3, 4, 7, 11, 1700]
                route_short_name:
                    type: string
                origin_route_name:
                    type: string
                run_number:
                    type: number
                is_regional:
                    type: string
                is_substitute_transport:
                    type: string
                is_night:
                    type: string
                trip_headsign:
                    type: string
                trip_short_name:
                    type: string
                    nullable: true
                block_id:
                    type: string
                    nullable: true
                exceptional:
                    type: number
                min_stop_time:
                    type: object
                    properties:
                        hours:
                            type: number
                        minutes:
                            type: number
                    required:
                        - hours
                max_stop_time:
                    type: object
                    properties:
                        hours:
                            type: number
                        minutes:
                            type: number
                    required:
                        - hours
                start_timestamp:
                    type: string
                end_timestamp:
                    type: string
                first_stop_id:
                    type: string
                last_stop_id:
                    type: string
                trip_number:
                    type: number
                    nullable: true
                route_licence_number:
                    type: number
                    nullable: true
                requiredTurnaroundSeconds:
                    type: number
                    nullable: true
        IUpdateDelayTripsIdsData:
            type: object
            properties:
                id:
                    type: string
                gtfs_trip_id:
                    type: string
                gtfs_block_id:
                    type: string
                gtfs_route_type:
                    type: number
                gtfs_direction_id:
                    type: number
                gtfs_shape_id:
                    type: string
                start_timestamp:
                    type: string
                end_timestamp:
                    type: string
                run_number:
                    type: number
                internal_run_number:
                    type: number
                origin_route_name:
                    type: string
                internal_route_name:
                    type: string
                vehicle_registration_number:
                    type: number
        IUpdateDelayRunTripsData:
            type: object
            properties:
                id:
                    type: string
                gtfs_trip_id:
                    type: string
                gtfs_block_id:
                    type: string
                gtfs_route_type:
                    type: number
                gtfs_direction_id:
                    type: number
                gtfs_shape_id:
                    type: string
                start_timestamp:
                    type: string
                end_timestamp:
                    type: string
                run_number:
                    type: number
                internal_run_number:
                    type: number
                origin_route_name:
                    type: string
                internal_route_name:
                    type: string
                vehicle_registration_number:
                    type: number
        IMpvPositionProperties:
            type: object
            properties:
                alias:
                    type: string
                asw:
                    type: string
                azimut:
                    type: string
                cpoz:
                    type: string
                dopr:
                    type: string
                doprSkut:
                    type: string
                info:
                    type: string
                kmenl:
                    type: string
                lat:
                    type: string
                lin:
                    type: string
                lng:
                    type: string
                np:
                    type: string
                po:
                    type: string
                rychl:
                    type: string
                sled:
                    type: string
                spoj:
                    type: string
                t:
                    type: string
                vuzevc:
                    type: string
                zast:
                    type: string
                zpoz_prij:
                    type: string
                zpoz_odj:
                    type: string
                zrus:
                    type: string
        IMpvStopProperties:
            type: object
            properties:
                odj:
                    type: string
                prij:
                    type: string
                stan:
                    type: string
                zast:
                    type: string
                asw:
                    type: string
                zpoz_odj:
                    type: string
                zpoz_prij:
                    type: string
                zpoz_typ_odj:
                    type: string
                zpoz_typ_prij:
                    type: string

        IMpvMessageContent:
            type: object
            properties:
                spoj:
                    oneOf:
                        - $ref: "#/components/schemas/IMpvPositionContent"
                        - type: array
                          items:
                              $ref: "#/components/schemas/IMpvPositionContent"
        IMpvPositionContent:
            type: object
            properties:
                $:
                    type: object
                    $ref: "#/components/schemas/IMpvPositionProperties"
        ITripPositionTuple:
            type: object
            properties:
                position:
                    type: object
                    description: All known positions with their properties
                    properties:
                        type:
                            type: string
                            example: "FeatureCollection"
                        features:
                            type: array
                            items:
                                allOf:
                                    - $ref: "#/components/schemas/FeaturePoint"
                                    - type: object
                                      properties:
                                          properties:
                                              $ref: "#/components/schemas/IVPTripsPositionAttributes"
                    required:
                        - type
                trip:
                    $ref: "#/components/schemas/IUpdateDelayRunTripsData"
        GeometryPoint:
            type: object
            description: GeoJson point
            properties:
                coordinates:
                    type: array
                    items:
                        type: number
                    example: [14.441252, 50.109318]
                    description: Point
                type:
                    type: string
                    enum:
                        - Point
        FeaturePoint:
            title: Feature Point
            type: object
            properties:
                geometry:
                    type: object
                    properties:
                        type:
                            type: string
                            example: "Point"
                        coordinates:
                            $ref: "#/components/schemas/GeometryPoint"
                    required:
                        - coordinates
                        - type
                properties:
                    type: object
                type:
                    type: string
                    example: "Feature"
            required:
                - geometry
                - properties
                - type
        IVPTripsPositionAttributes:
            type: object
            properties:
                bearing:
                    type: number
                    nullable: true
                lat:
                    type: number
                lng:
                    type: number
                origin_time:
                    type: string
                origin_timestamp:
                    type: string
                    format: date-time
                    description: >
                        Transmission time of the message from the vehicle (derived from tm).
                        Corresponds to the lat/lng position in the same message.
                scheduled_timestamp:
                    type: string
                    nullable: true
                    format: date-time
                    description: >
                        Actual event time — the real time of the vehicle arrival or departure at the stop
                        (derived from takt). Null for non-event positions.
                delay:
                    type: number
                    nullable: true
                is_tracked:
                    type: boolean
                id:
                    type: string
                shape_dist_traveled:
                    type: number
                    nullable: true
                is_canceled:
                    type: boolean
                state_position:
                    $ref: "#/components/schemas/StatePositionEnum"
                state_process:
                    $ref: "#/components/schemas/StateProcessEnum"
                tcp_event:
                    oneOf:
                        - $ref: "#/components/schemas/TCPEventEnum"
                        - $ref: "#/components/schemas/RegionalBusEventEnum"
                    nullable: true
                this_stop_sequence:
                    type: number
                    nullable: true
                this_stop_id:
                    type: string
                    nullable: true
                last_stop_sequence:
                    type: number
                    nullable: true
                last_stop_id:
                    type: string
                    nullable: true
                last_stop_name:
                    type: string
                    nullable: true
                last_stop_arrival_time:
                    type: string
                    nullable: true
                    format: date-time
                last_stop_departure_time:
                    type: string
                    nullable: true
                    format: date-time
                last_stop_headsign:
                    type: string
                    nullable: true
                next_stop_sequence:
                    type: number
                    nullable: true
                next_stop_id:
                    type: string
                    nullable: true
                next_stop_name:
                    type: string
                    nullable: true
                next_stop_arrival_time:
                    type: string
                    nullable: true
                    format: date-time
                next_stop_departure_time:
                    type: string
                    nullable: true
                    format: date-time
                valid_to:
                    type: string
                    nullable: true
                    format: date-time
        GTFSRouteTypeEnum:
            type: number
            enum: [0, 1, 2, 3, 4, 7, 11, 1700]
        StatePositionEnum:
            type: string
            enum:
                [
                    off_track,
                    at_stop,
                    on_track,
                    before_track,
                    after_track,
                    canceled,
                    invisible,
                    unknown,
                    before_track_delayed,
                    duplicate,
                    mismatched,
                    not_public,
                ]
        StateProcessEnum:
            type: string
            enum: [tcp_input, udp_input, input, processed]
        TCPEventEnum:
            type: string
            enum: [P, O, V, T]
        RegionalBusEventEnum:
            type: string
            enum: [R]
        IPropagateDelayInput:
            type: object
            properties:
                processedPositions:
                    type: array
                    items:
                        $ref: "#/components/schemas/IProcessedPositions"
                trips:
                    type: array
                    items:
                        oneOf:
                            - $ref: "#/components/schemas/IUpdateDelayTripsIdsData"
                            - $ref: "#/components/schemas/IUpdateDelayRunTripsData"
        IProcessedPositions:
            type: object
            properties:
                context:
                    $ref: "#/components/schemas/IVPTripsLastPositionContext"
                positions:
                    type: array
                    items:
                        $ref: "#/components/schemas/IPositionToUpdate"
        IVPTripsLastPositionContext:
            type: object
            properties:
                lastPositionId:
                    type: string
                    nullable: true
                lastPositionLat:
                    type: number
                    nullable: true
                lastPositionLng:
                    type: number
                    nullable: true
                lastPositionOriginTimestamp:
                    type: number
                    nullable: true
                lastPositionTracking:
                    type: object
                    description: All known positions with their properties
                    properties:
                        type:
                            type: string
                            example: "FeatureCollection"
                        features:
                            type: array
                            items:
                                allOf:
                                    - $ref: "#/components/schemas/FeaturePoint"
                                    - type: object
                                      properties:
                                          properties:
                                              $ref: "#/components/schemas/IVPTripsPositionAttributes"
                    required:
                        - type
                lastPositionCanceled:
                    type: boolean
                    nullable: true
                lastPositionLastStop:
                    type: object
                    properties:
                        id:
                            type: string
                            nullable: true
                        sequence:
                            type: number
                            nullable: true
                        arrival_time:
                            type: number
                            nullable: true
                        arrival_delay:
                            type: number
                            nullable: true
                        departure_time:
                            type: number
                            nullable: true
                        departure_delay:
                            type: number
                            nullable: true
                    nullable: true
                lastPositionDelay:
                    type: number
                    nullable: true
                atStopStreak:
                    $ref: "#/components/schemas/IVPTripsComputedPositionAtStopStreak"
                lastPositionBeforeTrackDelayed:
                    type: object
                    properties:
                        delay:
                            type: number
                            nullable: true
                        origin_timestamp:
                            type: string
                            format: date-time
                    nullable: true
                lastPositionState:
                    $ref: "#/components/schemas/StatePositionEnum"
                    nullable: true
                lastPositionStateChange:
                    type: string
                    format: date-time
                    nullable: true
                tripId:
                    type: string
            required:
                - tripId
        IVPTripsComputedPositionAtStopStreak:
            type: object
            properties:
                firstPositionTimestamp:
                    type: number
                    nullable: true
                firstPositionDelay:
                    type: number
                    nullable: true
                stop_sequence:
                    type: number
                    nullable: true
            required: []
        IPositionToUpdate:
            type: object
            properties:
                state_process:
                    type: string
                state_position:
                    type: string
                id:
                    type: string
                gtfsData:
                    $ref: "#/components/schemas/IComputationTrip"
                last_stop_headsign:
                    type: string
                    nullable: true
                this_stop_name:
                    type: string
                delay_stop_arrival:
                    type: number
                    nullable: true
                delay_stop_departure:
                    type: number
                    nullable: true
        IComputationTrip:
            type: object
            properties:
                trip_id:
                    type: string
                stop_times:
                    type: array
                    items:
                        $ref: "#/components/schemas/IStopTime"
                shapes_anchor_points:
                    type: array
                    items:
                        $ref: "#/components/schemas/IShapeAnchorPoint"
                shapes:
                    type: array
                    items:
                        $ref: "#/components/schemas/IComputationTripShape"
        Shape:
            type: object
            properties:
                shape_dist_traveled:
                    type: number
                shape_id:
                    type: string
                shape_pt_lat:
                    type: number
                shape_pt_lon:
                    type: number
                shape_pt_sequence:
                    type: number

        Stop:
            type: object
            properties:
                stop_id:
                    type: string
                stop_lat:
                    type: number
                stop_lon:
                    type: number
                stop_name:
                    type: string
                zone_id:
                    type: string
                    nullable: true
                wheelchair_boarding:
                    $ref: "#/components/schemas/GtfsStopWheelchairBoardingEnum"

        GtfsStopWheelchairBoardingEnum:
            type: string
            enum:
                - UNKNOWN
                - ACCESSIBLE
                - NOT_ACCESSIBLE

        TripWithShapesAndStopTimes:
            type: object
            properties:
                shape_id:
                    type: string
                shapes:
                    type: array
                    items:
                        $ref: "#/components/schemas/Shape"
                    nullable: true
                stop_times:
                    type: array
                    items:
                        $ref: "#/components/schemas/IStopTime"
                    nullable: true

        IStopTime:
            type: object
            properties:
                arrival_time_seconds:
                    type: number
                departure_time_seconds:
                    type: number
                shape_dist_traveled:
                    type: number
                stop_id:
                    type: string
                stop_sequence:
                    type: number
                stop_headsign:
                    type: string
                is_no_stop_waypoint:
                    type: boolean
                stop:
                    $ref: "#/components/schemas/Stop"
        IShapeAnchorPoint:
            type: object
            properties:
                index:
                    type: number
                at_stop:
                    type: boolean
                bearing:
                    type: number
                coordinates:
                    type: array
                    items:
                        type: number
                    minItems: 2
                    maxItems: 2
                distance_from_last_stop:
                    type: number
                last_stop_sequence:
                    type: number
                next_stop_sequence:
                    type: number
                shape_dist_traveled:
                    type: number
                this_stop_sequence:
                    type: number
                    nullable: true
                time_scheduled_seconds:
                    type: number
        IComputationTripShape:
            type: object
            properties:
                dist:
                    type: number
                coords:
                    type: array
                    items:
                        type: number
            required:
                - dist
                - coords
        ICommonRunsInput:
            type: object
            properties:
                M:
                    $ref: "#/components/schemas/ICommonRunsMessageContent"
        ICommonRunsMessageContent:
            type: object
            properties:
                V:
                    oneOf:
                        - $ref: "#/components/schemas/ICommonRunsMessagePropertiesWrapper"
                        - type: array
                          items:
                              $ref: "#/components/schemas/ICommonRunsMessagePropertiesWrapper"
        ICommonRunsMessagePropertiesWrapper:
            type: object
            properties:
                $:
                    $ref: "#/components/schemas/ICommonRunsMessageProperties"
        ICommonRunsMessageProperties:
            type: object
            properties:
                turnus:
                    type: string
                line:
                    type: string
                evc:
                    type: string
                np:
                    type: string
                lat:
                    type: string
                lng:
                    type: string
                akt:
                    type: string
                takt:
                    type: string
                    description: >
                        Actual event time — the real time of the vehicle arrival or departure at the stop.
                        Maps to scheduled_timestamp in processed positions.
                konc:
                    type: string
                tjr:
                    type: string
                    description: >
                        ROPID scheduled time according to the timetable — when the vehicle was supposed to be at this point.
                        Not used for position timestamp mapping.
                pkt:
                    type: string
                tm:
                    type: string
                    description: >
                        Transmission time — when the message was transmitted by DPP. Corresponds to the
                        lat/lng position reported in the same message. Maps to origin_timestamp in processed positions.
                events:
                    $ref: "#/components/schemas/TCPEventEnum"
        ICommonRunsInputElement:
            type: object
            properties:
                data:
                    $ref: "#/components/schemas/ICommonRunsMessagePropertiesWrapper"
                timestamp:
                    type: string
        ICommonRunsInputData:
            type: object
            properties:
                data:
                    oneOf:
                        - $ref: "#/components/schemas/ICommonRunsMessagePropertiesWrapper"
                        - type: array
                          items:
                              $ref: "#/components/schemas/ICommonRunsMessagePropertiesWrapper"
                timestamp:
                    type: number
        MetroRunsMessageProperties:
            type: object
            properties:
                linka:
                    type: string
                tm:
                    type: string
                gvd:
                    type: string
            required:
                - linka
                - tm
        MetroRunsTrainProperties:
            type: object
            properties:
                csp:
                    type: string
                csr:
                    type: string
                cv:
                    type: string
                ko:
                    type: string
                odch:
                    type: string
            required:
                - csp
                - csr
                - cv
                - ko
                - odch
        MetroRunsTrainContent:
            type: object
            properties:
                $:
                    $ref: "#/components/schemas/MetroRunsTrainProperties"
        MetroRunsMessageContent:
            type: object
            properties:
                $:
                    $ref: "#/components/schemas/MetroRunsMessageProperties"
                vlak:
                    oneOf:
                        - $ref: "#/components/schemas/MetroRunsTrainContent"
                        - type: array
                          items:
                              $ref: "#/components/schemas/MetroRunsTrainContent"
        IMetroRunsInput:
            type: object
            properties:
                m:
                    $ref: "#/components/schemas/MetroRunsMessageContent"
        IRegionalBusRunsInput:
            type: object
            properties:
                M:
                    $ref: "#/components/schemas/IRegionalBusRunsMessageContent"

        IRegionalBusRunsMessageContent:
            type: object
            properties:
                V:
                    oneOf:
                        - $ref: "#/components/schemas/IRegionalBusRunsMessagePropertiesWrapper"
                        - type: array
                          items:
                              $ref: "#/components/schemas/IRegionalBusRunsMessagePropertiesWrapper"

        IRegionalBusRunsMessagePropertiesWrapper:
            type: object
            properties:
                $:
                    $ref: "#/components/schemas/IRegionalBusRunsMessageProperties"

        IRegionalBusRunsMessageProperties:
            type: object
            properties:
                imei:
                    type: string
                line:
                    type: string
                conn:
                    type: string
                events:
                    type: string
                lat:
                    type: string
                lng:
                    type: string
                tm:
                    type: string
                evc:
                    type: string
                rych:
                    type: string
                smer:
                    type: string

        ITransformationInput:
            type: object
            properties:
                messages:
                    type: array
                    items:
                        $ref: "#/components/schemas/IRegionalBusRunsMessagePropertiesWrapper"
                timestamp:
                    type: number
        IProcessRegionalBusRunMessage:
            type: object
            properties:
                cis_line_id:
                    type: string
                cis_trip_number:
                    type: number
                registration_number:
                    type: number
            required:
                - cis_line_id
                - cis_trip_number
                - registration_number
        IProcessRegionalBusRunMessagesInput:
            type: object
            properties:
                messages:
                    type: array
                    items:
                        $ref: "#/components/schemas/IProcessRegionalBusRunMessage"
            required:
                - messages
        IProcessMetroRunsMessage:
            type: object
            properties:
                message_timestamp:
                    type: string
                    format: date-time
                actual_position_timestamp_scheduled:
                    type: string
                    format: date-time
            allOf:
                - $ref: "#/components/schemas/IMetroRunsMessagesModel"
            required:
                - message_timestamp
                - actual_position_timestamp_scheduled
        IProcessMetroRunsMessagesInput:
            type: object
            properties:
                routeName:
                    type: string
                messages:
                    type: array
                    items:
                        $ref: "#/components/schemas/IProcessMetroRunsMessage"
        IMetroRunsMessagesModel:
            type: object
            properties:
                route_name:
                    type: string
                message_timestamp:
                    type: string
                    format: date-time
                train_set_number_scheduled:
                    type: string
                train_set_number_real:
                    type: string
                train_number:
                    type: string
                track_id:
                    type: string
                delay_origin:
                    type: number
                actual_position_timestamp_scheduled:
                    type: string
                    format: date-time
        JISEvent:
            type: object
            required:
                - id
                - type
                - header_text
                - cause
                - cause_detail
                - severity_level
                - active_period
                - effect
                - effect_detail
                - description_text
                - url
                - organization_name
                - created_timestamp
                - last_modified_timestamp
            properties:
                id:
                    type: string
                    format: uuid
                    description: Unique identifier of the event in the UUIDv4 format
                    example: e5cc7b38-79e1-4f7a-b8de-884971e23412
                type:
                    type: string
                    example: INCIDENT
                    enum:
                        - INCIDENT
                        - DISRUPTION
                        - SERVICE_CHANGE
                header_text:
                    type: object
                    properties:
                        cs:
                            type: string
                            example: Nehoda Jiřího z Poděbrad
                        en:
                            type: string
                            example: Accident at Jiřího z Poděbrad
                            nullable: true
                    required:
                        - cs
                        - en
                cause:
                    type: string
                    example: ACCIDENT
                    enum:
                        - ACCIDENT
                        - STRIKE
                        - TECHNICAL_PROBLEM
                        - CONSTRUCTION
                        - WEATHER
                        - DEMONSTRATION
                        - POLICE_ACTIVITY
                        - MEDICAL_EMERGENCY
                        - OTHER_CAUSE
                        - UNKNOWN_CAUSE
                        - HOLIDAY
                        - MAINTENANCE
                cause_detail:
                    type: object
                    properties:
                        cs:
                            type: string
                            example: Nehoda na křižovatce
                            nullable: true
                        en:
                            type: string
                            example: Accident at the intersection
                            nullable: true
                severity_level:
                    type: string
                    example: SEVERE
                    enum:
                        - INFO
                        - WARNING
                        - SEVERE
                    description: |
                        INFO - priority 3 \
                        WARNING - priority 2 \
                        SEVERE - priority 1
                active_period:
                    type: object
                    required:
                        - start
                        - end
                    properties:
                        start:
                            type: string
                            format: date-time
                            example: "2024-02-29T11:22:20.958Z"
                        end:
                            type: string
                            format: date-time
                            nullable: true
                            example: "2024-03-03T14:22:20.958Z"
                    description: The start and end date/time of the event validity
                effect:
                    type: string
                    example: DETOUR
                    enum:
                        - DETOUR
                        - REDUCED_SERVICE
                        - MODIFIED_SERVICE
                        - SIGNIFICANT_DELAYS
                        - ADDITIONAL_SERVICE
                        - OTHER_EFFECT
                        - NO_SERVICE
                        - STOP_MOVED
                        - NO_EFFECT
                        - ACCESSIBILITY_ISSUE
                        - UNKNOWN_EFFECT
                effect_detail:
                    type: object
                    properties:
                        cs:
                            type: string
                            example: Tramvaje jezdí několik zastávek jinudy.
                        en:
                            type: string
                            example: Trams are running a few stops differently.
                            nullable: true
                    required:
                        - cs
                        - en
                description_text:
                    type: object
                    properties:
                      cs:
                        type: string
                        description: Event description in Czech
                      en:
                        type: string
                        nullable: true
                        description: Event description in English
                    required:
                      - cs
                      - en
                    description: Localized descriptions of the event
                url:
                    type: object
                    properties:
                        cs:
                            type: string
                            format: uri
                            example: https://pid.cz/zmena/cs/nehoda-jiriho-z-podebrad
                        en:
                            type: string
                            format: uri
                            nullable: true
                            example: https://pid.cz/zmena/en/accident-jiriho-z-podebrad
                    required:
                        - cs
                        - en
                organization_name:
                    type: string
                    example: ROPID
                informed_entity:
                    type: object
                    nullable: true
                    properties:
                      routes:
                        type: array
                        nullable: true
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: Unique GTFS identifier of the affected route
                          required:
                            - id
                last_modified_timestamp:
                    type: string
                    format: date-time
                    example: "2024-02-29T12:22:20.958Z"
                    description: Timestamp from when the event was last modified in VYMI
                created_timestamp:
                    type: string
                    format: date-time
                    example: "2024-02-29T12:22:20.958Z"
                    description: Timestamp from when the event was created in VYMI
        JISInfotext:
            type: object
            properties:
              id:
                type: string
                format: uuid
                description: Unique identifier for the infotext
              severity_level:
                type: string
                enum:
                  - SEVERE
                  - WARNING
                  - INFO
                description: Severity level of the infotext
              display_type:
                type: string
                description: How the infotext is displayed
              active_period:
                type: object
                properties:
                  start:
                    type: string
                    format: date-time
                    description: Start time of the active period
                  end:
                    type: string
                    format: date-time
                    description: End time of the active period
                required:
                  - start
                  - end
                description: The period during which the infotext is active
              repeat:
                type: object
                nullable: true
                description: Optional daily repeat schedule for the infotext
                properties:
                  enabled:
                    type: boolean
                    description: Whether the infotext repeats on a daily schedule
                  time_start:
                    type: string
                    nullable: true
                    description: Daily repeat start time (HH:MM:SS)
                  time_end:
                    type: string
                    nullable: true
                    description: Daily repeat end time (HH:MM:SS)
                required:
                  - enabled
              description_text:
                type: object
                properties:
                  cs:
                    type: string
                    description: Description in Czech
                  en:
                    type: string
                    description: Description in English
                required:
                  - cs
                  - en
                description: Localized descriptions of the infotext
              informed_entity:
                type: object
                nullable: true
                properties:
                  stops:
                    type: array
                    nullable: true
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Unique identifier for the stop
                      required:
                        - id
                  presets:
                    type: array
                    nullable: true
                    description: Departure presets connected to this infotext (optional, migration period)
                    items:
                      type: object
                      properties:
                        route_name:
                          type: string
                          description: Route name of the departure preset (ropid_departures_presets.route_name)
                      required:
                        - route_name
              created_timestamp:
                type: string
                format: date-time
                description: Timestamp when the infotext was created in VYMI
              last_modified_timestamp:
                type: string
                format: date-time
                description: Timestamp when the infotext was updated in VYMI
            required:
              - id
              - severity_level
              - display_type
              - active_period
              - description_text
              - created_timestamp
              - last_modified_timestamp
