// Part of the Chili3d Project, under the AGPL-3.0 License.
// See LICENSE file in the project root for full license information.

import {
    type Act,
    History,
    type IApplication,
    type IDocument,
    InternalClassName,
    type ISelection,
    type IView,
    type IVisual,
    type Material,
    ModelManager,
    ObservableCollection,
    type PropertyChangedHandler,
    type Serialized,
} from "@chili3d/core";

export class TestDocument implements IDocument {
    application: IApplication;
    name: string;
    id: string;
    history: History;
    selection: ISelection;
    visual: IVisual;
    activeView: IView | undefined;
    userData?: Record<string, unknown> | undefined;
    modelManager: ModelManager = new ModelManager(this);
    materials: ObservableCollection<Material> = new ObservableCollection<Material>();
    acts: ObservableCollection<Act> = new ObservableCollection<Act>();
    onPropertyChanged<K extends keyof this>(handler: PropertyChangedHandler<this, K>): void {
        throw new Error("Method not implemented.");
    }
    removePropertyChanged<K extends keyof this>(handler: PropertyChangedHandler<this, K>): void {
        throw new Error("Method not implemented.");
    }
    dispose() {
        throw new Error("Method not implemented.");
    }

    importFiles(files: File[] | FileList): Promise<void> {
        return Promise.resolve();
    }

    close(): Promise<void> {
        return Promise.resolve();
    }

    serialize(): Serialized {
        return {
            [InternalClassName]: "TestDocument",
            properties: {},
        };
    }

    constructor() {
        this.name = "test";
        this.id = "test";
        this.visual = {
            context: {
                removeNode: () => {},
                redrawNode: () => {},
                getVisual: () => undefined,
                setVisible: () => {},
            },
        } as any;
        this.history = new History();
        this.selection = {} as any;
        this.application = { views: [] } as any;
    }
    clearPropertyChanged(): void {
        throw new Error("Method not implemented.");
    }
    save(): Promise<void> {
        return Promise.resolve();
    }
}
