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

/**
 * FileService 文件服务
 * @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";

/**
 * EnsureDirectory 确保目录存在
 * @param {string} dirPath
 * @returns {$CancellablePromise<void>}
 */
export function EnsureDirectory(dirPath) {
    return $Call.ByID(1924614253, dirPath);
}

/**
 * FileExists 检查文件是否存在
 * @param {string} filePath
 * @returns {$CancellablePromise<boolean>}
 */
export function FileExists(filePath) {
    return $Call.ByID(26080110, filePath);
}

/**
 * GetFileSize 获取文件大小（字节）
 * @param {string} filePath
 * @returns {$CancellablePromise<number>}
 */
export function GetFileSize(filePath) {
    return $Call.ByID(3113069571, filePath);
}

/**
 * ListFiles 列出目录中的文件
 * @param {string} dirPath
 * @param {string} pattern
 * @returns {$CancellablePromise<string[]>}
 */
export function ListFiles(dirPath, pattern) {
    return $Call.ByID(1922143815, dirPath, pattern).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType0($result);
    }));
}

/**
 * OpenFolder 打开文件夹
 * @param {string} folderPath
 * @returns {$CancellablePromise<void>}
 */
export function OpenFolder(folderPath) {
    return $Call.ByID(578638620, folderPath);
}

/**
 * SelectFile 选择文件（返回路径）
 * @param {string} filter
 * @returns {$CancellablePromise<string>}
 */
export function SelectFile(filter) {
    return $Call.ByID(2093145774, filter);
}

/**
 * SelectFolder 选择文件夹（返回路径）
 * @returns {$CancellablePromise<string>}
 */
export function SelectFolder() {
    return $Call.ByID(23551676);
}

// Private type creation functions
const $$createType0 = $Create.Array($Create.Any);
