/**
 * 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 { observe_EmbeddedData, observe_DataElement, observe_RelationalDataTable, PackageableElementExplicitReference, observe_ModelData, } from '@finos/legend-graph';
import { addUniqueEntry, deleteEntry } from '@finos/legend-shared';
import { action } from 'mobx';
export const dataElement_setEmbeddedData = action((dataElement, value, context) => {
    dataElement.data = observe_EmbeddedData(value, context);
});
export const externalFormatData_setContentType = action((externalFormatData, value) => {
    externalFormatData.contentType = value;
});
export const externalFormatData_setData = action((externalFormatData, value) => {
    externalFormatData.data = value;
});
export const relationalData_setTableValues = action((data, values) => {
    data.values = values;
});
export const relationalData_setTableSchemaName = action((data, value) => {
    data.schema = value;
});
export const relationalData_addTable = action((data, val) => {
    addUniqueEntry(data.tables, observe_RelationalDataTable(val));
});
export const relationalData_setTableName = action((data, value) => {
    data.table = value;
});
export const relationalData_deleteData = action((data, val) => {
    deleteEntry(data.tables, val);
});
export const dataElementReference_setDataElement = action((dataElementReference, value, context) => {
    dataElementReference.dataElement =
        PackageableElementExplicitReference.create(observe_DataElement(value, context));
});
// Model Store
export const modelStoreData_addModelData = action((modelStoreData, value, context) => {
    const entries = modelStoreData.modelData ?? [];
    if (!modelStoreData.modelData) {
        modelStoreData.modelData = entries;
    }
    addUniqueEntry(entries, observe_ModelData(value, context));
});
export const modelStoreData_setDataModelModel = action((modelData, val) => {
    modelData.model = val;
});
export const modelStoreData_deleteModelData = action((modelStoreData, value) => {
    if (modelStoreData.modelData) {
        deleteEntry(modelStoreData.modelData, value);
    }
});
export const modelStoreData_setModelDataClass = action((modelData, val) => {
    modelData.model = val;
});
export const modelStoreData_setModelDataData = action((modelData, val) => {
    modelData.data = val;
});
//# sourceMappingURL=DSL_Data_GraphModifierHelper.js.map