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

/**
 * Service provides IDE functionality for code editing, file management, and project operations.
 * @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(2256800318);
}

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

/**
 * CreateDirectory creates a new directory at the given path.
 */
export function CreateDirectory(path: string): $CancellablePromise<void> {
    return $Call.ByID(4108527007, path);
}

/**
 * DeleteFile removes a file at the given path.
 */
export function DeleteFile(path: string): $CancellablePromise<void> {
    return $Call.ByID(1778361797, path);
}

/**
 * DetectLanguage returns the Monaco editor language for a given file path.
 */
export function DetectLanguage(path: string): $CancellablePromise<string> {
    return $Call.ByID(1446649409, path);
}

/**
 * FileExists checks if a file exists at the given path.
 */
export function FileExists(path: string): $CancellablePromise<boolean> {
    return $Call.ByID(2444049838, path);
}

/**
 * GetSupportedLanguages returns a list of languages supported by the editor.
 */
export function GetSupportedLanguages(): $CancellablePromise<$models.LanguageInfo[]> {
    return $Call.ByID(948137385).then(($result: any) => {
        return $$createType3($result);
    });
}

/**
 * ListDirectory returns a list of files and directories in the given path.
 */
export function ListDirectory(path: string): $CancellablePromise<$models.DirectoryEntry[]> {
    return $Call.ByID(2978024379, path).then(($result: any) => {
        return $$createType5($result);
    });
}

/**
 * NewFile creates a new untitled file with the specified language.
 */
export function NewFile(language: string): $CancellablePromise<$models.FileInfo> {
    return $Call.ByID(354339848, language).then(($result: any) => {
        return $$createType6($result);
    });
}

/**
 * OpenFile reads a file from disk and returns its content with language detection.
 */
export function OpenFile(path: string): $CancellablePromise<$models.FileInfo> {
    return $Call.ByID(1563991886, path).then(($result: any) => {
        return $$createType6($result);
    });
}

/**
 * ReadFile reads content from a file without additional metadata.
 */
export function ReadFile(path: string): $CancellablePromise<string> {
    return $Call.ByID(1836122514, path);
}

/**
 * RenameFile renames/moves a file from oldPath to newPath.
 */
export function RenameFile(oldPath: string, newPath: string): $CancellablePromise<void> {
    return $Call.ByID(128270740, oldPath, newPath);
}

/**
 * SaveFile saves content to the specified path.
 */
export function SaveFile(path: string, content: string): $CancellablePromise<void> {
    return $Call.ByID(1229744459, path, content);
}

// Private type creation functions
const $$createType0 = core$0.Core.createFrom;
const $$createType1 = $Create.Nullable($$createType0);
const $$createType2 = $models.LanguageInfo.createFrom;
const $$createType3 = $Create.Array($$createType2);
const $$createType4 = $models.DirectoryEntry.createFrom;
const $$createType5 = $Create.Array($$createType4);
const $$createType6 = $models.FileInfo.createFrom;
