// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

/**
 * Service manages user workspaces.
 * @module
 */

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as core$0 from "../core/models.js";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";

/**
 * ActiveWorkspace returns the currently active workspace, or nil if none is active.
 */
export function ActiveWorkspace(): $CancellablePromise<$models.Workspace | null> {
    return $Call.ByID(1950953690).then(($result: any) => {
        return $$createType1($result);
    });
}

/**
 * Config returns the registered Config service from the core application.
 * This is a convenience method for accessing the application's configuration.
 */
export function Config(): $CancellablePromise<core$0.Config> {
    return $Call.ByID(1263760661);
}

/**
 * Core returns the central core instance, providing access to all registered services.
 */
export function Core(): $CancellablePromise<core$0.Core | null> {
    return $Call.ByID(235692716).then(($result: any) => {
        return $$createType3($result);
    });
}

/**
 * CreateWorkspace creates a new, obfuscated workspace on the local medium.
 */
export function CreateWorkspace(identifier: string, password: string): $CancellablePromise<string> {
    return $Call.ByID(1795228612, identifier, password);
}

/**
 * HandleIPCEvents processes IPC messages, including injecting dependencies on startup.
 */
export function HandleIPCEvents(c: core$0.Core | null, msg: core$0.Message): $CancellablePromise<void> {
    return $Call.ByID(2170147968, c, msg);
}

/**
 * ListWorkspaces returns the list of workspace IDs.
 */
export function ListWorkspaces(): $CancellablePromise<string[]> {
    return $Call.ByID(539524341).then(($result: any) => {
        return $$createType4($result);
    });
}

/**
 * SwitchWorkspace changes the active workspace.
 */
export function SwitchWorkspace(name: string): $CancellablePromise<void> {
    return $Call.ByID(3125647852, name);
}

/**
 * WorkspaceFileGet retrieves a file from the active workspace.
 */
export function WorkspaceFileGet(filename: string): $CancellablePromise<string> {
    return $Call.ByID(3718387990, filename);
}

/**
 * WorkspaceFileSet writes a file to the active workspace.
 */
export function WorkspaceFileSet(filename: string, content: string): $CancellablePromise<void> {
    return $Call.ByID(1806719962, filename, content);
}

// Private type creation functions
const $$createType0 = $models.Workspace.createFrom;
const $$createType1 = $Create.Nullable($$createType0);
const $$createType2 = core$0.Core.createFrom;
const $$createType3 = $Create.Nullable($$createType2);
const $$createType4 = $Create.Array($Create.Any);
