"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.JISInfotextsTransformation = void 0;
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
let JISInfotextsTransformation = class JISInfotextsTransformation extends AbstractTransformation_1.AbstractTransformation {
    constructor() {
        super(...arguments);
        this.name = "JISInfotextsTransformation";
        this.transformInternal = (data) => {
            const infotext = {
                id: data.id,
                severity_level: data.severity_level,
                display_type: data.display_type,
                active_period_start: new Date(data.active_period.start),
                active_period_end: data.active_period.end ? new Date(data.active_period.end) : null,
                description_text: data.description_text,
                created_timestamp: new Date(data.created_timestamp),
                updated_timestamp: new Date(data.last_modified_timestamp),
            };
            const infotextsRopidGTFSStops = data.informed_entity?.stops?.map(({ id }) => ({
                infotext_id: data.id,
                stop_id: id,
            })) ?? [];
            return {
                infotext,
                infotextsRopidGTFSStops,
            };
        };
    }
};
exports.JISInfotextsTransformation = JISInfotextsTransformation;
exports.JISInfotextsTransformation = JISInfotextsTransformation = __decorate([
    (0, tsyringe_1.injectable)()
], JISInfotextsTransformation);
//# sourceMappingURL=JISInfotextsTransformation.js.map