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

/**
 * Service wraps Registry for Wails service registration.
 * @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";

/**
 * 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(2666037348);
}

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

/**
 * GetAvailableContexts returns all available contexts.
 */
export function GetAvailableContexts(): $CancellablePromise<string[]> {
    return $Call.ByID(581350213).then(($result: any) => {
        return $$createType2($result);
    });
}

/**
 * GetContext returns the current context.
 */
export function GetContext(): $CancellablePromise<string> {
    return $Call.ByID(2851668817);
}

/**
 * GetMenus returns menus for the current context.
 */
export function GetMenus(): $CancellablePromise<$models.MenuItem[]> {
    return $Call.ByID(2772432318).then(($result: any) => {
        return $$createType4($result);
    });
}

/**
 * GetModule returns a specific module by code.
 */
export function GetModule(code: string): $CancellablePromise<[$models.Config, boolean]> {
    return $Call.ByID(2941496402, code).then(($result: any) => {
        $result[0] = $$createType5($result[0]);
        return $result;
    });
}

/**
 * GetModules returns all registered modules.
 */
export function GetModules(): $CancellablePromise<$models.Config[]> {
    return $Call.ByID(565704691).then(($result: any) => {
        return $$createType6($result);
    });
}

/**
 * GetRoutes returns routes for the current context.
 */
export function GetRoutes(): $CancellablePromise<$models.Route[]> {
    return $Call.ByID(2452947460).then(($result: any) => {
        return $$createType8($result);
    });
}

/**
 * GetUIConfig returns complete UI config for the current context.
 */
export function GetUIConfig(): $CancellablePromise<$models.UIConfig> {
    return $Call.ByID(1850432430).then(($result: any) => {
        return $$createType9($result);
    });
}

/**
 * RegisterModule registers a module from JSON config string.
 */
export function RegisterModule(jsonConfig: string): $CancellablePromise<void> {
    return $Call.ByID(3476381919, jsonConfig);
}

/**
 * Registry returns the underlying registry for direct access.
 */
export function Registry(): $CancellablePromise<$models.Registry | null> {
    return $Call.ByID(406000161).then(($result: any) => {
        return $$createType11($result);
    });
}

/**
 * SetContext changes the active UI context.
 */
export function SetContext(ctx: string): $CancellablePromise<void> {
    return $Call.ByID(2231690805, ctx);
}

/**
 * UnregisterModule removes a module by code.
 */
export function UnregisterModule(code: string): $CancellablePromise<void> {
    return $Call.ByID(514107996, code);
}

// Private type creation functions
const $$createType0 = core$0.Core.createFrom;
const $$createType1 = $Create.Nullable($$createType0);
const $$createType2 = $Create.Array($Create.Any);
const $$createType3 = $models.MenuItem.createFrom;
const $$createType4 = $Create.Array($$createType3);
const $$createType5 = $models.Config.createFrom;
const $$createType6 = $Create.Array($$createType5);
const $$createType7 = $models.Route.createFrom;
const $$createType8 = $Create.Array($$createType7);
const $$createType9 = $models.UIConfig.createFrom;
const $$createType10 = $models.Registry.createFrom;
const $$createType11 = $Create.Nullable($$createType10);
