"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.OperationAddArtifactAttributePersistence = void 0;
const internal_1 = require("../../../internal");
const utils = require("../utils");
const OperationBasePersistence_1 = require("./OperationBasePersistence");
const Persistence_1 = require("../../../Persistence");
/**
 * Operation AddArtifactAttribute persistence
 */
class OperationAddArtifactAttributePersistence {
    static fromData(ctx, object) {
        if (!object) {
            return undefined;
        }
        const alterTraitsOp = OperationBasePersistence_1.OperationBasePersistence.fromData(ctx, internal_1.cdmObjectType.operationAddArtifactAttributeDef, object);
        alterTraitsOp.newAttribute = utils.createAttribute(ctx, object.newAttribute);
        alterTraitsOp.insertAtTop = object.insertAtTop;
        return alterTraitsOp;
    }
    static toData(instance, resOpt, options) {
        if (!instance) {
            return undefined;
        }
        const data = OperationBasePersistence_1.OperationBasePersistence.toData(instance, resOpt, options);
        data.newAttribute = Persistence_1.PersistenceLayer.toData(instance.newAttribute, resOpt, options, 'CdmFolder');
        data.insertAtTop = instance.insertAtTop;
        return data;
    }
}
exports.OperationAddArtifactAttributePersistence = OperationAddArtifactAttributePersistence;
OperationAddArtifactAttributePersistence.TAG = OperationAddArtifactAttributePersistence.name;
//# sourceMappingURL=OperationAddArtifactAttributePersistence.js.map