"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MetroMessageFilter = void 0;
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
class MetroMessageFilter {
    static getValidMessagesWithTrackIds(messages) {
        let filteredMessages = [];
        let trackIds = new Set();
        for (const message of messages) {
            const { delay_origin, track_id } = message;
            if (delay_origin < MetroMessageFilter.DELAY_ORIGIN_RANGE_MIN ||
                delay_origin > MetroMessageFilter.DELAY_ORIGIN_RANGE_MAX) {
                helpers_1.log.warn(`getValidMessagesWithTrackIds: delay origin ${delay_origin} is out of range ` +
                    `[${MetroMessageFilter.DELAY_ORIGIN_RANGE_MIN}, ${MetroMessageFilter.DELAY_ORIGIN_RANGE_MAX}]`);
                continue;
            }
            filteredMessages.push(message);
            trackIds.add(track_id);
        }
        return {
            filteredMessages,
            trackIds: Array.from(trackIds),
        };
    }
}
exports.MetroMessageFilter = MetroMessageFilter;
MetroMessageFilter.DELAY_ORIGIN_RANGE_MIN = -4 * 60 * 60; // 4 hours delay
MetroMessageFilter.DELAY_ORIGIN_RANGE_MAX = 1 * 60 * 60; // 1 hour ahead of time
//# sourceMappingURL=MetroMessageFilter.js.map