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

/**
 * Core is the central application object that manages services, assets, and communication.
 * @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 embed$0 from "../../../../../embed/models.js";

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

/**
 * ACTION dispatches a message to all registered IPC handlers.
 * This is the primary mechanism for services to communicate with each other.
 */
export function ACTION(msg: $models.Message): $CancellablePromise<void> {
    return $Call.ByID(4292948361, msg);
}

/**
 * Assets returns the embedded filesystem containing the application's assets.
 */
export function Assets(): $CancellablePromise<embed$0.FS> {
    return $Call.ByID(3418392250).then(($result: any) => {
        return $$createType0($result);
    });
}

/**
 * Config returns the registered Config service.
 */
export function Config(): $CancellablePromise<$models.Config> {
    return $Call.ByID(189298201);
}

/**
 * Core returns self, implementing the CoreProvider interface.
 */
export function Core(): $CancellablePromise<$models.Core | null> {
    return $Call.ByID(1780022976).then(($result: any) => {
        return $$createType2($result);
    });
}

/**
 * Crypt returns the registered Crypt service.
 */
export function Crypt(): $CancellablePromise<$models.Crypt> {
    return $Call.ByID(2268164577);
}

/**
 * Display returns the registered Display service.
 */
export function Display(): $CancellablePromise<$models.Display> {
    return $Call.ByID(2677615899);
}

/**
 * PERFORM dispatches a task to handlers until one executes it.
 * Returns (result, handled, error). If no handler responds, handled is false.
 */
export function PERFORM(t: $models.Task): $CancellablePromise<[any, boolean]> {
    return $Call.ByID(4123176972, t);
}

/**
 * PerformAsync dispatches a task to be executed in a background goroutine.
 * It returns a unique task ID that can be used to track the task's progress.
 * The result of the task will be broadcasted via an ActionTaskCompleted message.
 */
export function PerformAsync(t: $models.Task): $CancellablePromise<string> {
    return $Call.ByID(2093358608, t);
}

/**
 * Progress broadcasts a progress update for a background task.
 */
export function Progress(taskID: string, progress: number, message: string, t: $models.Task): $CancellablePromise<void> {
    return $Call.ByID(1583922996, taskID, progress, message, t);
}

/**
 * QUERY dispatches a query to handlers until one responds.
 * Returns (result, handled, error). If no handler responds, handled is false.
 */
export function QUERY(q: $models.Query): $CancellablePromise<[any, boolean]> {
    return $Call.ByID(3538289785, q);
}

/**
 * QUERYALL dispatches a query to all handlers and collects all responses.
 * Returns all results from handlers that responded.
 */
export function QUERYALL(q: $models.Query): $CancellablePromise<any[]> {
    return $Call.ByID(2503646560, q).then(($result: any) => {
        return $$createType3($result);
    });
}

/**
 * RegisterAction adds a new IPC handler to the Core.
 */
export function RegisterAction(handler: any): $CancellablePromise<void> {
    return $Call.ByID(4133311524, handler);
}

/**
 * RegisterActions adds multiple IPC handlers to the Core.
 */
export function RegisterActions(...handlers: any[]): $CancellablePromise<void> {
    return $Call.ByID(736871669, handlers);
}

/**
 * RegisterQuery adds a query handler to the Core.
 */
export function RegisterQuery(handler: $models.QueryHandler): $CancellablePromise<void> {
    return $Call.ByID(3624744914, handler);
}

/**
 * RegisterService adds a new service to the Core.
 */
export function RegisterService(name: string, api: any): $CancellablePromise<void> {
    return $Call.ByID(984069509, name, api);
}

/**
 * RegisterTask adds a task handler to the Core.
 */
export function RegisterTask(handler: $models.TaskHandler): $CancellablePromise<void> {
    return $Call.ByID(2729221523, handler);
}

/**
 * Service retrieves a registered service by name.
 * It returns nil if the service is not found.
 */
export function Service(name: string): $CancellablePromise<any> {
    return $Call.ByID(3781502542, name);
}

/**
 * Workspace returns the registered Workspace service.
 */
export function Workspace(): $CancellablePromise<$models.Workspace> {
    return $Call.ByID(3152134880);
}

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