"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicVPTripInfoTransformation = void 0;
const RouteTypeEnums_1 = require("../../../../../helpers/RouteTypeEnums");
const shared_1 = require("../../../../shared");
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
class PublicVPTripInfoTransformation extends AbstractTransformation_1.AbstractTransformation {
    constructor() {
        super(...arguments);
        this.name = "TripInfoTransformation";
        this.transformInternal = ({ detailed_info, ...element }) => {
            const originTimestamp = new Date(detailed_info.origin_timestamp);
            return {
                gtfs_trip_id: element.gtfs_trip_id,
                route_type: (RouteTypeEnums_1.GTFSRouteTypeEnum[element.route_type] ?? RouteTypeEnums_1.GTFSRouteTypeEnum[1700]).toLowerCase(),
                route_short_name: element.gtfs_route_short_name,
                shape_id: detailed_info.shape_id,
                origin_route_name: detailed_info.origin_route_name,
                run_number: detailed_info.run_number,
                trip_headsign: detailed_info.trip_headsign,
                geometry: {
                    type: "Point",
                    coordinates: [element.lng, element.lat],
                },
                shape_dist_traveled: detailed_info.shape_dist_traveled,
                bearing: element.bearing,
                delay: element.delay,
                state_position: element.state_position,
                last_stop_sequence: detailed_info.last_stop_sequence,
                origin_timestamp: shared_1.RopidRouterUtils.formatTimestamp(originTimestamp, "Europe/Prague"),
            };
        };
    }
}
exports.PublicVPTripInfoTransformation = PublicVPTripInfoTransformation;
//# sourceMappingURL=PublicVPTripInfoTransformation.js.map