"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegionalBusComputeDelayHelper = void 0;
const FactoryDelayAtStop_1 = __importDefault(require("./strategy/FactoryDelayAtStop"));
class RegionalBusComputeDelayHelper {
    /**
     * Saves relevant information to calculate delays in future vehicle position iterations.
     */
    static updateContext(context, positionToUpdate, position, gtfsRouteType) {
        context.lastPositionDelay = positionToUpdate ? positionToUpdate.delay : position.delay;
        return (FactoryDelayAtStop_1.default.getInstance().getStrategy(gtfsRouteType)?.updateContext(context, positionToUpdate, position) ??
            context);
    }
    /**
     * Adds info about delay at stop to positionToUpdate based on current position and context from previous positions.
     */
    static updatePositionToUpdate(context, positionToUpdate, position, gtfsRouteType) {
        return (FactoryDelayAtStop_1.default.getInstance().getStrategy(gtfsRouteType)?.updatePosition(context, positionToUpdate, position) ??
            positionToUpdate);
    }
}
exports.RegionalBusComputeDelayHelper = RegionalBusComputeDelayHelper;
//# sourceMappingURL=RegionalBusComputeDelayHelper.js.map