"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.ManifestDeclarationPersistence = void 0;
const internal_1 = require("../../internal");
const timeUtils = require("../../Utilities/timeUtils");
class ManifestDeclarationPersistence {
    /**
     * Creates an instance from object of folder type.
     * @param ctx The context.
     * @param dataObj The object to read data from.
     * @returns A new CdmManifestDeclarationDefinition instance generated.
     */
    static fromData(ctx, dataObj) {
        const newFolderDec = ctx.corpus.MakeObject(internal_1.cdmObjectType.manifestDeclarationDef, dataObj.manifestName);
        newFolderDec.definition = dataObj.definition;
        if (dataObj.lastFileStatusCheckTime) {
            newFolderDec.lastFileStatusCheckTime = new Date(dataObj.lastFileStatusCheckTime);
        }
        if (dataObj.lastFileModifiedTime) {
            newFolderDec.lastFileModifiedTime = new Date(dataObj.lastFileModifiedTime);
        }
        if (dataObj.explanation) {
            newFolderDec.explanation = dataObj.explanation;
        }
        return newFolderDec;
    }
    static toData(instance, resOpt, options) {
        return {
            lastFileStatusCheckTime: timeUtils.getFormattedDateString(instance.lastFileStatusCheckTime),
            lastFileModifiedTime: timeUtils.getFormattedDateString(instance.lastFileModifiedTime),
            explanation: instance.explanation,
            manifestName: instance.manifestName,
            definition: instance.definition
        };
    }
}
exports.ManifestDeclarationPersistence = ManifestDeclarationPersistence;
//# sourceMappingURL=ManifestDeclarationPersistence.js.map