/**
 * 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 { makeObservable, observable, override } from 'mobx';
import { ModelAccessPointGroup, DataProductEmbeddedImageIcon, DataProductLibraryIcon, LakehouseAccessPoint, UnknownDataProductIcon, } from '../../../graph/metamodel/pure/dataProduct/DataProduct.js';
import { observe_Abstract_PackageableElement, observe_PackageableElementReference, skipObserved, } from './CoreObserverHelper.js';
import { observe_StereotypeReference, observe_TaggedValue, } from './DomainObserverHelper.js';
export const observe_AccessPoint = skipObserved((metamodel) => {
    if (metamodel instanceof LakehouseAccessPoint) {
        makeObservable(metamodel, {
            id: observable,
            title: observable,
            targetEnvironment: observable,
            classification: observable,
            func: observable.ref,
            description: observable,
            reproducible: observable,
        });
    }
    // TODO others
    return metamodel;
});
export const observe_Email = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        title: observable,
        address: observable,
    });
    return metamodel;
});
export const observer_DataProductLink = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        label: observable,
        url: observable,
    });
    return metamodel;
});
export const observe_Expertise = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        description: observable,
        expertIds: observable,
    });
    return metamodel;
});
export const observe_SupportInfo = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        documentation: observable,
        website: observable,
        faqUrl: observable,
        supportUrl: observable,
        emails: observable,
        expertise: observable,
    });
    metamodel.emails.forEach(observe_Email);
    metamodel.expertise?.forEach(observe_Expertise);
    if (metamodel.documentation) {
        observer_DataProductLink(metamodel.documentation);
    }
    if (metamodel.website) {
        observer_DataProductLink(metamodel.website);
    }
    if (metamodel.faqUrl) {
        observer_DataProductLink(metamodel.faqUrl);
    }
    if (metamodel.supportUrl) {
        observer_DataProductLink(metamodel.supportUrl);
    }
    return metamodel;
});
export const observe_OperationalMetadata = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        updateFrequency: observable,
        coverageRegions: observable,
    });
    return metamodel;
});
export const observe_DataProductRuntimeInfo = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        id: observable,
        description: observable,
        runtime: observable,
    });
    return metamodel;
});
export const observe_DataProductElementScope = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        exclude: observable,
        element: observable,
    });
    return metamodel;
});
export const observe_DataProductDiagram = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        title: observable,
        description: observable,
        diagram: observable,
    });
    return metamodel;
});
export const observe_AccessPointGroup = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        id: observable,
        description: observable,
        title: observable,
        accessPoints: observable,
        stereotypes: observable,
        taggedValues: observable,
    });
    metamodel.stereotypes.forEach(observe_StereotypeReference);
    metamodel.taggedValues.forEach(observe_TaggedValue);
    metamodel.accessPoints.forEach(observe_AccessPoint);
    return metamodel;
});
export const observe_ModelAccessPointGroup = skipObserved((metamodel) => {
    observe_AccessPointGroup(metamodel);
    makeObservable(metamodel, {
        mapping: observable,
        featuredElements: observable,
        diagrams: observable,
    });
    observe_PackageableElementReference(metamodel.mapping);
    metamodel.featuredElements.forEach(observe_DataProductElementScope);
    metamodel.diagrams.forEach(observe_DataProductDiagram);
    return metamodel;
});
export const observe_APG = (metamodel) => {
    if (metamodel instanceof ModelAccessPointGroup) {
        return observe_ModelAccessPointGroup(metamodel);
    }
    else {
        return observe_AccessPointGroup(metamodel);
    }
};
export const observe_DataProductIcon = skipObserved((metamodel) => {
    if (metamodel instanceof DataProductLibraryIcon) {
        makeObservable(metamodel, {
            libraryId: observable,
            iconId: observable,
        });
    }
    else if (metamodel instanceof DataProductEmbeddedImageIcon) {
        makeObservable(metamodel, {
            imageUrl: observable,
        });
    }
    else if (metamodel instanceof UnknownDataProductIcon) {
        makeObservable(metamodel, {
            content: observable,
        });
    }
    return metamodel;
});
export const observe_DataProduct = skipObserved((metamodel) => {
    observe_Abstract_PackageableElement(metamodel);
    makeObservable(metamodel, {
        accessPointGroups: observable,
        _elementHashCode: override,
        title: observable,
        description: observable,
        supportInfo: observable,
        icon: observable,
        type: observable,
        operationalMetadata: observable,
    });
    if (metamodel.supportInfo) {
        observe_SupportInfo(metamodel.supportInfo);
    }
    if (metamodel.icon) {
        observe_DataProductIcon(metamodel.icon);
    }
    if (metamodel.operationalMetadata) {
        observe_OperationalMetadata(metamodel.operationalMetadata);
    }
    metamodel.accessPointGroups.forEach(observe_APG);
    return metamodel;
});
//# sourceMappingURL=DataProductObserveHelper.js.map