"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SnapshotHandler = void 0;
const converters_1 = require("./converters");
class SnapshotHandler {
    constructor(dispatcher, snapshot) {
        this.dispatch = dispatcher.dispatch.bind(this);
        this.snapshot = snapshot;
        this.cloneInternal =
            this.snapshot === 'main'
                ? () => this.dispatch({ method: 'snapshot_clone' })
                : () => {
                };
    }
    commit() {
        return this.dispatch({
            method: 'snapshot_commit',
            args: {
                snapshot: this.snapshot,
            },
        });
    }
    getChangeSet() {
        return converters_1.parseChangeReturns(this.dispatch({
            method: 'snapshot_get_change_set',
            args: {
                snapshot: this.snapshot,
            },
        }));
    }
    clone() {
        this.cloneInternal();
    }
    reset() {
        return this.dispatch({
            method: 'snapshot_reset',
        });
    }
}
exports.SnapshotHandler = SnapshotHandler;

//# sourceMappingURL=SnapshotHandler.js.map
