"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectRepositoryFactory = void 0;
const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
const Di_1 = require("../../vehicle-positions/ioc/Di");
const VPContainerToken_1 = require("../../vehicle-positions/ioc/VPContainerToken");
const CisStopRepository_1 = require("../../vehicle-positions/workers/vehicle-positions/data-access/CisStopRepository");
const PositionsHistoryRepository_1 = require("../../vehicle-positions/workers/vehicle-positions/data-access/PositionsHistoryRepository");
const StopTimesHistoryRepository_1 = require("../../vehicle-positions/workers/vehicle-positions/data-access/StopTimesHistoryRepository");
const TripsHistoryRepository_1 = require("../../vehicle-positions/workers/vehicle-positions/data-access/TripsHistoryRepository");
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
const CommonRunsRepository_1 = require("../../vehicle-positions/workers/runs/data-access/CommonRunsRepository");
const MetroRunsMessagesRepository_1 = require("../../vehicle-positions/workers/runs/data-access/MetroRunsMessagesRepository");
const RegionalBusRunsMessagesRepository_1 = require("../../vehicle-positions/workers/runs/data-access/RegionalBusRunsMessagesRepository");
const PositionsRepository_1 = require("../../vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository");
const RepositoryTableNameEnum_1 = require("../workers/constants/RepositoryTableNameEnum");
class SelectRepositoryFactory {
    select(repo) {
        switch (repo) {
            case RepositoryTableNameEnum_1.RepositoryTableName.Trips:
                return Di_1.VPContainer.resolve(VPContainerToken_1.VPContainerToken.TripRepository);
            case RepositoryTableNameEnum_1.RepositoryTableName.TripsHistory:
                return new TripsHistoryRepository_1.TripsHistoryRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.Positions:
                return new PositionsRepository_1.PositionsRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.PositionsHistory:
                return new PositionsHistoryRepository_1.PositionsHistoryRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.CisStops:
                return new CisStopRepository_1.CisStopRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.StopTimesHistory:
                return new StopTimesHistoryRepository_1.StopTimesHistoryRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.Metro:
                return new MetroRunsMessagesRepository_1.MetroRunsMessagesRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.RegionalBus:
                return new RegionalBusRunsMessagesRepository_1.RegionalBusRunsMessagesRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.CommonRuns:
                return new CommonRunsRepository_1.CommonRunsRepository();
            case RepositoryTableNameEnum_1.RepositoryTableName.Logs:
                return Di_1.VPContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.PresetLogRepository);
            default:
                throw new golemio_errors_1.GeneralError("Repository type undefined.");
        }
    }
    getColumnNameByRepositoryName(repo) {
        switch (repo) {
            case RepositoryTableNameEnum_1.RepositoryTableName.Metro:
                return "message_timestamp";
            case RepositoryTableNameEnum_1.RepositoryTableName.RegionalBus:
                return "vehicle_timestamp";
            case RepositoryTableNameEnum_1.RepositoryTableName.CommonRuns:
                return "msg_last_timestamp";
            default:
                return "";
        }
    }
}
exports.SelectRepositoryFactory = SelectRepositoryFactory;
//# sourceMappingURL=SelectRepositoryFactory.js.map