'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaDescribe = void 0;
exports.checkSchemaExists = checkSchemaExists;
exports.checkSchemaTableExists = checkSchemaTableExists;
exports.schemaDescribe = require('../dataLayer/schemaDescribe');
const hdbError_ts_1 = require("../utility/errors/hdbError.js");
const databases_ts_1 = require("../resources/databases.js");
/**
 * Checks the global hdbSchema for a schema and table
 * @param schemaName
 * @param tableName
 * @returns string returns a thrown message if schema and or table does not exist
 */
async function checkSchemaExists(schemaName) {
    let databases = (0, databases_ts_1.getDatabases)();
    if (!databases[schemaName]) {
        return hdbError_ts_1.hdbErrors.HDB_ERROR_MSGS.SCHEMA_NOT_FOUND(schemaName);
    }
}
/**
 * Checks the global hdbSchema for a schema and table
 * @param schemaName
 * @param tableName
 * @returns string returns a thrown message if schema and or table does not exist
 */
async function checkSchemaTableExists(schemaName, tableName) {
    let invalidSchema = await checkSchemaExists(schemaName);
    if (invalidSchema) {
        return invalidSchema;
    }
    let databases = (0, databases_ts_1.getDatabases)();
    if (!databases[schemaName][tableName]) {
        return hdbError_ts_1.hdbErrors.HDB_ERROR_MSGS.TABLE_NOT_FOUND(schemaName, tableName);
    }
}
//# sourceMappingURL=schemaMetadataValidator.js.map