declare module "@hiberworld/engine/distribute/hiber.js" {
    import type { Property } from "@hiberworld/engine/distribute/types/property";

    export type PrefabTransform = {
        position: { x: number; y: number; z: number };
        scale: { x: number; y: number; z: number };
        quaternion: { x: number; y: number; z: number; w: number };
    };

    export type EngineApi = {
        setPlayerAvatar: (id: string) => void;
        fetchAssetManifest: <T = Record<string, unknown>>() => Promise<T>;
        setApi: (api: EngineApi) => void;
        worldApplyPropertyToObject: <T extends keyof Property>(
            objectId: string,
            propertyType: string,
            propertyData: Property[T]
        ) => void;
        worldClear: (...args: unknown[]) => void;
        worldCreateGroup: (...args: unknown[]) => string;
        worldCreateObject: (...args: unknown[]) => string;
        worldGetObjectsInGroup: (...args: unknown[]) => string[];
        worldGetJson: () => string;
        worldPlacePrefab: (
            prefabId: string,
            transform: PrefabTransform,
            material?: string
        ) => string;
        worldMoveGroup: (...args: unknown[]) => void;
        worldRemoveGroup: (...args: unknown[]) => void;
        worldChangeEnvironment: (id: string) => void;
        worldRayCast: (...args: unknown[]) => void;
        waitForResourceLoading: (...args: unknown[]) => void;
        hasPendingResourceIO: (...args: unknown[]) => void;
        applyPropertyToObject: (
            objectId: string,
            prop: Record<string, unknown>,
            apply: boolean
        ) => void;
        applyPropertyToGroup: (...args: unknown[]) => void;
        createMaestroEvent: (...args: unknown[]) => void;
        getAvatarPosition: () => [number, number, number];
        getAvatarDirection: () => [number, number, number];
        getCameraPosition: (...args: unknown[]) => void;
        getCameraDirection: (...args: unknown[]) => void;
        mute: (...args: unknown[]) => void;
        unmute: (...args: unknown[]) => void;
        login: (...args: unknown[]) => void;
        saveLevel: (...args: unknown[]) => void;
        getDirFromScreenCoords: (...args: unknown[]) => void;
        setPlayerAvatarUrl: (url: string, provider: string) => void;
        setPlayerMovementMode: (mode: string) => void;
        loadGlb: (...args: unknown[]) => void;
        respawnPlayer: (...args: unknown[]) => void;
    };

    export interface HiberEmbeddedOptions {
        levelId?: string;
        initSessionRequest: boolean;
        sessionType: string;
        extraArgs: string[];
        wasmUrl?: string;
        engineUrl?: string;
        onPrint?: (message: string) => void;
    }

    export function launch(
        canvasId: string,
        options: HiberEmbeddedOptions
    ): Promise<EngineApi>;
}
