/**
 * 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 { UnsupportedOperationError } from '@finos/legend-shared';
import { V1_buildFullPath, } from './V1_GraphBuilderContext.js';
import { V1_buildConstraint, V1_buildDerivedProperty, } from './helpers/V1_DomainBuilderHelper.js';
import { V1_buildDatabaseSchemaViewsSecondPass } from './helpers/V1_DatabaseBuilderHelper.js';
export class V1_ElementFifthPassBuilder {
    context;
    constructor(context) {
        this.context = context;
    }
    visit_PackageableElement(element) {
        this.context.extensions
            .getExtraBuilderOrThrow(element)
            .runFifthPass(element, this.context);
    }
    visit_INTERNAL__UnknownElement(element) {
        throw new UnsupportedOperationError();
    }
    visit_INTERNAL__UnknownPackageableElement(element) {
        throw new UnsupportedOperationError();
    }
    visit_INTERNAL__UnknownFunctionActivator(element) {
        throw new UnsupportedOperationError();
    }
    visit_INTERNAL__UnknownStore(element) {
        return;
    }
    visit_Profile(element) {
        throw new UnsupportedOperationError();
    }
    visit_Enumeration(element) {
        throw new UnsupportedOperationError();
    }
    visit_Measure(element) {
        throw new UnsupportedOperationError();
    }
    visit_IngestDefinition(element) {
        throw new UnsupportedOperationError();
    }
    visit_Class(element) {
        const _class = this.context.currentSubGraph.getOwnClass(V1_buildFullPath(element.package, element.name));
        _class.derivedProperties = element.derivedProperties.map((derivedProperty) => V1_buildDerivedProperty(derivedProperty, this.context, _class));
        _class.constraints = element.constraints.map((constraint) => V1_buildConstraint(constraint, _class, this.context));
    }
    visit_Association(element) {
        throw new UnsupportedOperationError();
    }
    visit_ConcreteFunctionDefinition(element) {
        throw new UnsupportedOperationError();
    }
    visit_FlatData(element) {
        return;
    }
    visit_Database(element) {
        const database = this.context.currentSubGraph.getOwnDatabase(V1_buildFullPath(element.package, element.name));
        element.schemas.forEach((schema) => V1_buildDatabaseSchemaViewsSecondPass(schema, this.context, database));
    }
    visit_Mapping(element) {
        throw new UnsupportedOperationError();
    }
    visit_Service(element) {
        throw new UnsupportedOperationError();
    }
    visit_SectionIndex(element) {
        throw new UnsupportedOperationError();
    }
    visit_FileGeneration(element) {
        throw new UnsupportedOperationError();
    }
    visit_GenerationSpecification(element) {
        throw new UnsupportedOperationError();
    }
    visit_PackageableRuntime(element) {
        throw new UnsupportedOperationError();
    }
    visit_PackageableConnection(element) {
        throw new UnsupportedOperationError();
    }
    visit_DataElement(element) {
        throw new UnsupportedOperationError();
    }
    visit_ExecutionEnvironmentInstance(element) {
        throw new UnsupportedOperationError();
    }
    visit_SnowflakeApp(element) {
        throw new UnsupportedOperationError();
    }
    visit_SnowflakeM2MUdf(element) {
        throw new UnsupportedOperationError();
    }
    visit_HostedService(element) {
        throw new UnsupportedOperationError();
    }
    visit_MemSQLFunction(element) {
        throw new UnsupportedOperationError();
    }
    visit_DataProduct(element) {
        throw new UnsupportedOperationError();
    }
}
//# sourceMappingURL=V1_ElementFifthPassBuilder.js.map