"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @module botbuilder-dialogs
 */
/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */
const memoryScope_1 = require("./memoryScope");
const scopePath_1 = require("../scopePath");
/**
 * ThisMemoryScope maps "this" -> dc.activeDialog.state
 */
class ThisMemoryScope extends memoryScope_1.MemoryScope {
    constructor() {
        super(scopePath_1.ScopePath.this);
    }
    getMemory(dc) {
        return dc.activeDialog ? dc.activeDialog.state : undefined;
    }
    setMemory(dc, memory) {
        if (memory == undefined) {
            throw new Error(`ThisMemoryScope.setMemory: undefined memory object passed in.`);
        }
        if (!dc.activeDialog) {
            throw new Error(`ThisMemoryScope.setMemory: no active dialog found.`);
        }
        dc.activeDialog.state = memory;
    }
}
exports.ThisMemoryScope = ThisMemoryScope;
//# sourceMappingURL=thisMemoryScope.js.map