/**
 * Copyright (c) 2020-present, Goldman Sachs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { hashArray } from '@finos/legend-shared';
import { CORE_HASH_STRUCTURE } from '../../../../../../../../../graph/Core_HashUtils.js';
import { V1_Connection, } from '../../../../../model/packageableElements/connection/V1_Connection.js';
/**
 * TODO: to be modularized or handled differently
 *
 * @modularize
 * See https://github.com/finos/legend-studio/issues/946
 * See https://github.com/finos/legend-studio/issues/65
 */
export var V1_DatabaseType;
(function (V1_DatabaseType) {
    V1_DatabaseType["DB2"] = "DB2";
    V1_DatabaseType["H2"] = "H2";
    V1_DatabaseType["MemSQL"] = "MemSQL";
    V1_DatabaseType["Sybase"] = "Sybase";
    V1_DatabaseType["SybaseIQ"] = "SybaseIQ";
    V1_DatabaseType["Composite"] = "Composite";
    V1_DatabaseType["Postgres"] = "Postgres";
    V1_DatabaseType["SqlServer"] = "SqlServer";
    V1_DatabaseType["Hive"] = "Hive";
    V1_DatabaseType["Snowflake"] = "Snowflake";
    V1_DatabaseType["BigQuery"] = "BigQuery";
    V1_DatabaseType["Databricks"] = "Databricks";
    V1_DatabaseType["Presto"] = "Presto";
    V1_DatabaseType["Redshift"] = "Redshift";
    V1_DatabaseType["Spanner"] = "Spanner";
    V1_DatabaseType["Trino"] = "Trino";
    V1_DatabaseType["DuckDB"] = "DuckDB";
})(V1_DatabaseType || (V1_DatabaseType = {}));
export class V1_DatabaseConnection extends V1_Connection {
    type;
    // this mirrors `type` and probably should removed
    databaseType;
    timeZone;
    quoteIdentifiers;
    queryTimeOutInSeconds;
    postProcessorWithParameter = [];
    queryGenerationConfigs = [];
}
export class V1_RelationalDatabaseConnection extends V1_DatabaseConnection {
    datasourceSpecification;
    authenticationStrategy;
    postProcessors = [];
    /**
     * HACKY: this is done to quickly add support for local connection
     * See https://github.com/finos/legend-engine/pull/1807
     */
    localMode;
    get hashCode() {
        return hashArray([
            CORE_HASH_STRUCTURE.RELATIONAL_DATABASE_CONNECTION,
            this.store ?? '',
            this.timeZone ?? '',
            this.quoteIdentifiers?.toString() ?? '',
            this.datasourceSpecification,
            this.authenticationStrategy,
            this.localMode?.toString() ?? '',
            this.queryTimeOutInSeconds?.toString() ?? '',
            hashArray(this.postProcessors),
            hashArray(this.queryGenerationConfigs),
        ]);
    }
    accept_ConnectionVisitor(visitor) {
        return visitor.visit_RelationalDatabaseConnection(this);
    }
}
//# sourceMappingURL=V1_RelationalDatabaseConnection.js.map