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

/**
 * Service provides access to the application's configuration.
 * It handles loading, saving, and providing access to configuration values,
 * abstracting away the details of file I/O and data serialization.
 * The Service is designed to be a central point for all configuration-related
 * operations within the application.
 * 
 * The fields of the Service struct are automatically saved to and loaded from
 * a JSON configuration file. The `json:"-"` tag on ServiceRuntime prevents
 * it from being serialized.
 * @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";

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

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

/**
 * DisableFeature disables a feature by removing it from the features list.
 * If the feature is not enabled, this is a no-op.
 * 
 * Example:
 * 
 * 	err := cfg.DisableFeature("dark_mode")
 * 	if err != nil {
 * 		log.Printf("Failed to disable feature: %v", err)
 * 	}
 */
export function DisableFeature(feature: string): $CancellablePromise<void> {
    return $Call.ByID(796720498, feature);
}

/**
 * EnableFeature enables a feature by adding it to the features list.
 * If the feature is already enabled, this is a no-op.
 * 
 * Example:
 * 
 * 	err := cfg.EnableFeature("dark_mode")
 * 	if err != nil {
 * 		log.Printf("Failed to enable feature: %v", err)
 * 	}
 */
export function EnableFeature(feature: string): $CancellablePromise<void> {
    return $Call.ByID(953595547, feature);
}

/**
 * Get retrieves a configuration value by its key. The key corresponds to the
 * JSON tag of a field in the Service struct. The retrieved value is stored in
 * the `out` parameter, which must be a non-nil pointer to a variable of the
 * correct type.
 * 
 * Example:
 * 
 * 	var currentLanguage string
 * 	err := cfg.Get("language", &currentLanguage)
 * 	if err != nil {
 * 		log.Printf("Could not retrieve language setting: %v", err)
 * 	}
 * 	fmt.Println("Current language is:", currentLanguage)
 */
export function Get(key: string, out: any): $CancellablePromise<void> {
    return $Call.ByID(1987004372, key, out);
}

/**
 * HandleIPCEvents processes IPC messages for the config service.
 */
export function HandleIPCEvents(c: core$0.Core | null, msg: core$0.Message): $CancellablePromise<void> {
    return $Call.ByID(1015502349, c, msg);
}

/**
 * IsFeatureEnabled checks if a feature is enabled.
 * 
 * Example:
 * 
 * 	if cfg.IsFeatureEnabled("dark_mode") {
 * 		// Apply dark mode styles
 * 	}
 */
export function IsFeatureEnabled(feature: string): $CancellablePromise<boolean> {
    return $Call.ByID(1495993163, feature);
}

/**
 * LoadKeyValues loads a map of key-value pairs from a file in the config
 * directory. The file format is determined by the extension of the `key`
 * parameter. This allows for easy retrieval of data stored in various formats.
 * 
 * Example:
 * 
 * 	dbConfig, err := cfg.LoadKeyValues("database.yml")
 * 	if err != nil {
 * 		log.Printf("Error loading database config: %v", err)
 * 	}
 * 	port, ok := dbConfig["port"].(int)
 * 	// ...
 */
export function LoadKeyValues(key: string): $CancellablePromise<{ [_: string]: any }> {
    return $Call.ByID(1235871433, key).then(($result: any) => {
        return $$createType2($result);
    });
}

/**
 * LoadStruct loads an arbitrary struct from a JSON file in the config directory.
 * The `key` parameter specifies the filename (without the .json extension). The
 * loaded data is unmarshaled into the `data` parameter, which must be a
 * non-nil pointer to a struct.
 * 
 * Example:
 * 
 * 	var prefs UserPreferences
 * 	err := cfg.LoadStruct("user_prefs", &prefs)
 * 	if err != nil {
 * 		log.Printf("Error loading user preferences: %v", err)
 * 	}
 * 	fmt.Printf("User theme is: %s", prefs.Theme)
 */
export function LoadStruct(key: string, data: any): $CancellablePromise<void> {
    return $Call.ByID(2823566133, key, data);
}

/**
 * Save writes the current configuration to a JSON file. The location of the file
 * is determined by the ConfigPath field of the Service struct. This method is
 * typically called automatically by Set, but can be used to explicitly save
 * changes.
 * 
 * Example:
 * 
 * 	err := cfg.Save()
 * 	if err != nil {
 * 		log.Printf("Error saving configuration: %v", err)
 * 	}
 */
export function Save(): $CancellablePromise<void> {
    return $Call.ByID(1923338053);
}

/**
 * SaveKeyValues saves a map of key-value pairs to a file in the config
 * directory. The file format is determined by the extension of the `key`
 * parameter. This method is a convenient way to store structured data in a
 * format of choice.
 * 
 * Example:
 * 
 * 	data := map[string]interface{}{"host": "localhost", "port": 8080}
 * 	err := cfg.SaveKeyValues("database.yml", data)
 * 	if err != nil {
 * 		log.Printf("Error saving database config: %v", err)
 * 	}
 */
export function SaveKeyValues(key: string, data: { [_: string]: any }): $CancellablePromise<void> {
    return $Call.ByID(2830367426, key, data);
}

/**
 * SaveStruct saves an arbitrary struct to a JSON file in the config directory.
 * This is useful for storing complex data that is not part of the main
 * configuration. The `key` parameter is used as the filename (with a .json
 * extension).
 * 
 * Example:
 * 
 * 	type UserPreferences struct {
 * 		Theme string `json:"theme"`
 * 		Notifications bool `json:"notifications"`
 * 	}
 * 	prefs := UserPreferences{Theme: "dark", Notifications: true}
 * 	err := cfg.SaveStruct("user_prefs", prefs)
 * 	if err != nil {
 * 		log.Printf("Error saving user preferences: %v", err)
 * 	}
 */
export function SaveStruct(key: string, data: any): $CancellablePromise<void> {
    return $Call.ByID(2819770048, key, data);
}

/**
 * Set updates a configuration value and saves the change to the configuration
 * file. The key corresponds to the JSON tag of a field in the Service struct.
 * The provided value `v` must be of a type that is assignable to the field.
 * 
 * Example:
 * 
 * 	err := cfg.Set("default_route", "/home")
 * 	if err != nil {
 * 		log.Printf("Failed to set default route: %v", err)
 * 	}
 */
export function Set(key: string, v: any): $CancellablePromise<void> {
    return $Call.ByID(2438166024, key, v);
}

// Private type creation functions
const $$createType0 = core$0.Core.createFrom;
const $$createType1 = $Create.Nullable($$createType0);
const $$createType2 = $Create.Map($Create.Any, $Create.Any);
