"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicGtfsTripStopTimesTransformation = void 0;
const AccessibilityEnums_1 = require("../../../../../helpers/AccessibilityEnums");
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
const output_gateway_1 = require("@golemio/core/dist/output-gateway");
const luxon_1 = require("@golemio/core/dist/shared/luxon");
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
let PublicGtfsTripStopTimesTransformation = class PublicGtfsTripStopTimesTransformation extends AbstractTransformation_1.AbstractTransformation {
    constructor() {
        super(...arguments);
        this.name = "GtfsTripStopTimesTransformation";
        this.transformInternal = (stopTime) => {
            const stop = stopTime.stop;
            const startDateTime = luxon_1.DateTime.now().startOf("day");
            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: startDateTime.plus({ seconds: stopTime.arrival_time_seconds }).toFormat("HH:mm:ss"),
                departure_time: startDateTime.plus({ seconds: stopTime.departure_time_seconds }).toFormat("HH:mm:ss"),
                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.PublicGtfsTripStopTimesTransformation = PublicGtfsTripStopTimesTransformation;
exports.PublicGtfsTripStopTimesTransformation = PublicGtfsTripStopTimesTransformation = __decorate([
    (0, tsyringe_1.injectable)()
], PublicGtfsTripStopTimesTransformation);
//# sourceMappingURL=PublicTripStopTimesTransformation.js.map