"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SavePresetsDataTask = void 0;
const Di_1 = require("../../../ioc/Di");
const RopidGtfsContainerToken_1 = require("../../../ioc/RopidGtfsContainerToken");
const ropid_departures_presets_1 = require("../../../../../schema-definitions/ropid-departures-presets");
const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
class SavePresetsDataTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
    constructor(queuePrefix) {
        super(queuePrefix);
        this.queueName = "savePresets";
        this.queueTtl = 5 * 60 * 1000; // 5 minutes
        this.schema = new golemio_validator_1.JSONSchemaValidator(ropid_departures_presets_1.RopidDeparturesPresets.name + "Controller", ropid_departures_presets_1.RopidDeparturesPresets.datasourceJsonSchema);
    }
    async execute(data) {
        const facade = Di_1.RopidGtfsContainer.resolve(RopidGtfsContainerToken_1.RopidGtfsContainerToken.DeparturePresetsFacade);
        await facade.handleNewDeparturePresets(data, new Date().toISOString());
    }
}
exports.SavePresetsDataTask = SavePresetsDataTask;
//# sourceMappingURL=SavePresetsDataTask.js.map