// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { NotebookModel } from './model';
/**
 * A model factory for notebooks.
 */
export class NotebookModelFactory {
    /**
     * Construct a new notebook model factory.
     */
    constructor(options) {
        var _a;
        this._disposed = false;
        this._collaborative = (_a = options.collaborative) !== null && _a !== void 0 ? _a : true;
        this._disableDocumentWideUndoRedo =
            options.disableDocumentWideUndoRedo || false;
        const codeCellContentFactory = options.codeCellContentFactory;
        this.contentFactory =
            options.contentFactory ||
                new NotebookModel.ContentFactory({ codeCellContentFactory });
    }
    /**
     * Define the disableDocumentWideUndoRedo property.
     */
    set disableDocumentWideUndoRedo(disableDocumentWideUndoRedo) {
        this._disableDocumentWideUndoRedo = disableDocumentWideUndoRedo;
    }
    /**
     * The name of the model.
     */
    get name() {
        return 'notebook';
    }
    /**
     * The content type of the file.
     */
    get contentType() {
        return 'notebook';
    }
    /**
     * The format of the file.
     */
    get fileFormat() {
        return 'json';
    }
    /**
     * Whether the model is collaborative or not.
     */
    get collaborative() {
        return this._collaborative;
    }
    /**
     * Get whether the model factory has been disposed.
     */
    get isDisposed() {
        return this._disposed;
    }
    /**
     * Dispose of the model factory.
     */
    dispose() {
        this._disposed = true;
    }
    /**
     * Create a new model for a given path.
     *
     * @param languagePreference - An optional kernel language preference.
     * @param modelDB - An optional model storage.
     * @param isInitialized - Whether the model is initialized or not.
     * @param collaborationEnabled - Whether collaboration is enabled at the application level or not (default `false`).
     *
     * @returns A new document model.
     */
    createNew(languagePreference, modelDB, isInitialized, collaborationEnabled) {
        const contentFactory = this.contentFactory;
        return new NotebookModel({
            languagePreference,
            contentFactory,
            collaborationEnabled: collaborationEnabled && this.collaborative,
            modelDB,
            isInitialized,
            disableDocumentWideUndoRedo: this._disableDocumentWideUndoRedo
        });
    }
    /**
     * Get the preferred kernel language given a path.
     */
    preferredLanguage(path) {
        return '';
    }
}
//# sourceMappingURL=modelfactory.js.map