/**
 * 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 } from 'mobx';
import {} from '../model/valueSpecification/V1_ValueSpecification.js';
import { V1_Lambda } from '../model/valueSpecification/raw/V1_Lambda.js';
import { skipObserved } from '../../../../action/changeDetection/CoreObserverHelper.js';
import { V1_observe_GenericType } from './V1_DomainObserverHelper.js';
const V1_observe_Abstract_ValueSpecification = (metamodel) => {
    makeObservable(metamodel, {});
};
export const V1_observe_Variable = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        name: observable,
        multiplicity: observable,
        genericType: observable,
    });
    if (metamodel.genericType) {
        V1_observe_GenericType(metamodel.genericType);
    }
    return metamodel;
});
export const V1_observe_AppliedFunction = skipObserved(_V1_observe_AppliedFunction);
export const V1_observe_AppliedProperty = skipObserved(_V1_observe_AppliedProperty);
// Observer functions for primitive types
const V1_observe_PrimitiveType = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        value: observable,
    });
    return metamodel;
});
export const V1_observe_EnumValue = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        fullPath: observable,
        value: observable,
    });
    return metamodel;
});
export const V1_observe_Collection = skipObserved(_V1_observe_Collection);
export const V1_observe_KeyExpression = skipObserved(_V1_observe_KeyExpression);
export const V1_observe_ColSpec = skipObserved(_V1_observe_ColSpec);
export const V1_observe_ColSpecArray = skipObserved((metamodel) => {
    makeObservable(metamodel, {
        colSpecs: observable,
    });
    metamodel.colSpecs.forEach(V1_observe_ColSpec);
    return metamodel;
});
export const V1_observe_Lambda = skipObserved(_V1_observe_Lambda);
const V1_observe_INTERNAL__UnknownValueSpecification = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        content: observable.ref,
    });
    return metamodel;
});
export const V1_observe_PackageableElementPtr = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        multiplicity: observable,
        fullPath: observable,
    });
    return metamodel;
});
export const V1_observe_GenericTypeInstance = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        multiplicity: observable,
        genericType: observable,
    });
    V1_observe_GenericType(metamodel.genericType);
    return metamodel;
});
export const V1_observe_ClassInstance = skipObserved((metamodel) => {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        multiplicity: observable,
        type: observable,
        value: observable,
    });
    return metamodel;
});
class V1_ValueSpecificationObserver {
    visit_INTERNAL__UnknownValueSpecfication(valueSpecification) {
        V1_observe_INTERNAL__UnknownValueSpecification(valueSpecification);
    }
    visit_AppliedFunction(valueSpecification) {
        V1_observe_AppliedFunction(valueSpecification);
    }
    visit_Variable(valueSpecification) {
        V1_observe_Variable(valueSpecification);
    }
    visit_Lambda(valueSpecification) {
        V1_observe_Lambda(valueSpecification);
    }
    visit_KeyExpression(valueSpecification) {
        V1_observe_KeyExpression(valueSpecification);
    }
    visit_AppliedProperty(valueSpecification) {
        V1_observe_AppliedProperty(valueSpecification);
    }
    visit_PackageableElementPtr(valueSpecification) {
        V1_observe_PackageableElementPtr(valueSpecification);
    }
    visit_GenericTypeInstance(valueSpecification) {
        V1_observe_GenericTypeInstance(valueSpecification);
    }
    visit_Collection(valueSpecification) {
        V1_observe_Collection(valueSpecification);
    }
    visit_EnumValue(valueSpecification) {
        V1_observe_EnumValue(valueSpecification);
    }
    visit_CInteger(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CDecimal(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CString(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CBoolean(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CByteArray(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CFloat(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CDateTime(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CStrictDate(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CStrictTime(valueSpecification) {
        V1_observe_PrimitiveType(valueSpecification);
    }
    visit_CLatestDate(valueSpecification) {
        V1_observe_Abstract_ValueSpecification(valueSpecification);
    }
    visit_ClassInstance(valueSpecification) {
        V1_observe_ClassInstance(valueSpecification);
    }
}
/**
 * Make a V1_ValueSpecification observable
 *
 * @param valueSpecification - The V1_ValueSpecification to make observable
 * @returns The observed V1_ValueSpecification
 */
export const V1_observe_ValueSpecification = skipObserved((valueSpecification) => {
    valueSpecification.accept_ValueSpecificationVisitor(new V1_ValueSpecificationObserver());
    return valueSpecification;
});
function V1_observe_Abstract_AppliedFunction(metamodel) {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        multiplicity: observable,
    });
    return metamodel;
}
function _V1_observe_AppliedFunction(metamodel) {
    V1_observe_Abstract_AppliedFunction(metamodel);
    makeObservable(metamodel, {
        function: observable,
        fControl: observable,
        parameters: observable,
    });
    metamodel.parameters.forEach(V1_observe_ValueSpecification);
    return metamodel;
}
function _V1_observe_AppliedProperty(metamodel) {
    V1_observe_Abstract_AppliedFunction(metamodel);
    makeObservable(metamodel, {
        class: observable,
        property: observable,
        parameters: observable,
    });
    metamodel.parameters.forEach(V1_observe_ValueSpecification);
    return metamodel;
}
function _V1_observe_Collection(metamodel) {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        multiplicity: observable,
        values: observable,
    });
    metamodel.values.forEach(V1_observe_ValueSpecification);
    return metamodel;
}
function _V1_observe_KeyExpression(metamodel) {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        add: observable,
        expression: observable,
        key: observable,
    });
    V1_observe_ValueSpecification(metamodel.key);
    V1_observe_ValueSpecification(metamodel.expression);
    return metamodel;
}
function _V1_observe_ColSpec(metamodel) {
    makeObservable(metamodel, {
        name: observable,
        type: observable,
        function1: observable,
        function2: observable,
    });
    if (metamodel.function1 && metamodel.function1 instanceof V1_Lambda) {
        V1_observe_Lambda(metamodel.function1);
    }
    if (metamodel.function2 && metamodel.function2 instanceof V1_Lambda) {
        V1_observe_Lambda(metamodel.function2);
    }
    return metamodel;
}
function _V1_observe_Lambda(metamodel) {
    V1_observe_Abstract_ValueSpecification(metamodel);
    makeObservable(metamodel, {
        body: observable,
        parameters: observable,
    });
    metamodel.body.forEach(V1_observe_ValueSpecification);
    metamodel.parameters.forEach(V1_observe_Variable);
    return metamodel;
}
//# sourceMappingURL=V1_ValueSpecificationObserver.js.map