"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicVPTripStopTimesTransformation = void 0;
const AccessibilityEnums_1 = require("../../../../../helpers/AccessibilityEnums");
const DateTimeUtils_1 = require("../../../../../helpers/DateTimeUtils");
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
class PublicVPTripStopTimesTransformation extends AbstractTransformation_1.AbstractTransformation {
    constructor() {
        super(...arguments);
        this.name = "TripStopTimesTransformation";
        this.transformInternal = ({ stopTime, vehiclePosition }) => {
            const { stop } = stopTime;
            const properties = {
                stop_name: stop.stop_name,
                stop_sequence: stopTime.stop_sequence,
                zone_id: stop.zone_id,
                is_wheelchair_accessible: this.isStopWheelchairAccessible(stop),
                shape_dist_traveled: stopTime.shape_dist_traveled,
                arrival_time: DateTimeUtils_1.DateTimeUtils.formatStopTime(DateTimeUtils_1.DateTimeUtils.getStopDateTimeForTripOrigin(stopTime.arrival_time_seconds, vehiclePosition.detailed_info.origin_timestamp)),
                departure_time: DateTimeUtils_1.DateTimeUtils.formatStopTime(DateTimeUtils_1.DateTimeUtils.getStopDateTimeForTripOrigin(stopTime.departure_time_seconds, vehiclePosition.detailed_info.origin_timestamp)),
                realtime_arrival_time: null, // later filled by realtime data
                realtime_departure_time: null, // later filled by realtime data
                lng: stop.stop_lon,
                lat: stop.stop_lat,
            };
            return (0, output_gateway_1.buildGeojsonFeature)(properties, "lng", "lat", true);
        };
        this.isStopWheelchairAccessible = ({ wheelchair_boarding }) => {
            if (wheelchair_boarding === null || wheelchair_boarding === AccessibilityEnums_1.GtfsStopWheelchairBoardingEnum.NoInformation) {
                return null;
            }
            return wheelchair_boarding === AccessibilityEnums_1.GtfsStopWheelchairBoardingEnum.AccessibleStation;
        };
    }
}
exports.PublicVPTripStopTimesTransformation = PublicVPTripStopTimesTransformation;
//# sourceMappingURL=PublicVPTripStopTimesTransformation.js.map