"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveMethod = exports.getTableNameFromModel = exports.datasetFileModelMap = exports.isCachedDataset = exports.CacheContentType = exports.ORIGIN_HOSTNAME_HEADER = void 0;
const DatasetEnum_1 = require("../../../../helpers/DatasetEnum");
const ropid_gtfs_1 = require("../../../../../../schema-definitions/ropid-gtfs");
exports.ORIGIN_HOSTNAME_HEADER = "x-origin-hostname";
var CacheContentType;
(function (CacheContentType) {
    CacheContentType["CSV"] = "CSV";
    CacheContentType["JSON"] = "JSON";
})(CacheContentType || (exports.CacheContentType = CacheContentType = {}));
const isCachedDataset = (obj) => {
    return obj instanceof Object && obj.filepath !== undefined && obj.name !== undefined && obj.dataset !== undefined;
};
exports.isCachedDataset = isCachedDataset;
const datasetFileModelMap = (dataset, name) => {
    let model;
    switch (dataset) {
        case DatasetEnum_1.DatasetEnum.PID_GTFS:
            model = name;
            break;
        case DatasetEnum_1.DatasetEnum.RUN_NUMBERS:
            model = "run_numbers";
            break;
        case DatasetEnum_1.DatasetEnum.OIS_MAPPING:
            model = "ois";
            break;
        case DatasetEnum_1.DatasetEnum.CIS_STOPS:
            model = ["cis_stops", "cis_stop_groups"];
            break;
        default:
            throw new Error(`Error mapping dataset ${dataset} and source ${name}`);
    }
    return model;
};
exports.datasetFileModelMap = datasetFileModelMap;
const getTableNameFromModel = (modelName) => {
    return ropid_gtfs_1.RopidGTFS[modelName].pgTableName;
};
exports.getTableNameFromModel = getTableNameFromModel;
var SaveMethod;
(function (SaveMethod) {
    SaveMethod["STREAM"] = "stream";
    SaveMethod["SEQUELIZE"] = "sequelize";
})(SaveMethod || (exports.SaveMethod = SaveMethod = {}));
//# sourceMappingURL=HelperTypes.js.map