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

/**
 * AppService 应用服务，暴露给前端调用
 * @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 application$0 from "../../../../wailsapp/wails/v3/pkg/application/models.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as config$0 from "../../config/models.js";

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

/**
 * AbortMerge 中止合并
 * @param {string} path
 * @returns {$CancellablePromise<void>}
 */
export function AbortMerge(path) {
    return $Call.ByID(3035150106, path);
}

/**
 * AddPlatform 添加新平台
 * @param {string} name
 * @param {string} baseURL
 * @returns {$CancellablePromise<void>}
 */
export function AddPlatform(name, baseURL) {
    return $Call.ByID(526003212, name, baseURL);
}

/**
 * AddProject 添加项目到指定平台/用户下
 * @param {string} platform
 * @param {string} username
 * @param {string} name
 * @param {string} path
 * @returns {$CancellablePromise<void>}
 */
export function AddProject(platform, username, name, path) {
    return $Call.ByID(2299402672, platform, username, name, path);
}

/**
 * AddUser 添加用户到指定平台
 * @param {string} platform
 * @param {string} username
 * @param {string} token
 * @returns {$CancellablePromise<void>}
 */
export function AddUser(platform, username, token) {
    return $Call.ByID(2264426704, platform, username, token);
}

/**
 * BatchPull 批量拉取指定项目
 * @param {string[]} paths
 * @returns {$CancellablePromise<$models.BatchPullResult[]>}
 */
export function BatchPull(paths) {
    return $Call.ByID(758996647, paths).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType1($result);
    }));
}

/**
 * BatchPush 批量推送指定项目
 * @param {string[]} paths
 * @returns {$CancellablePromise<$models.BatchPullResult[]>}
 */
export function BatchPush(paths) {
    return $Call.ByID(794082076, paths).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType1($result);
    }));
}

/**
 * CheckGitInstalled 检查 Git 是否已安装
 * @returns {$CancellablePromise<$models.GitStatus>}
 */
export function CheckGitInstalled() {
    return $Call.ByID(464620426).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType2($result);
    }));
}

/**
 * CheckoutRemoteBranch 检出远程分支到本地
 * @param {string} path
 * @param {string} remoteBranch
 * @returns {$CancellablePromise<void>}
 */
export function CheckoutRemoteBranch(path, remoteBranch) {
    return $Call.ByID(3682237522, path, remoteBranch);
}

/**
 * CloneProject 克隆远程仓库到本地目录，并添加到项目树
 * @param {string} platform
 * @param {string} username
 * @param {string} repoURL
 * @param {string} parentDir
 * @param {string} name
 * @returns {$CancellablePromise<void>}
 */
export function CloneProject(platform, username, repoURL, parentDir, name) {
    return $Call.ByID(2347019414, platform, username, repoURL, parentDir, name);
}

/**
 * CommitChanges 提交已暂存的更改
 * @param {string} path
 * @param {string} message
 * @returns {$CancellablePromise<void>}
 */
export function CommitChanges(path, message) {
    return $Call.ByID(921984546, path, message);
}

/**
 * CreateBranch 创建新分支
 * @param {string} path
 * @param {string} name
 * @returns {$CancellablePromise<void>}
 */
export function CreateBranch(path, name) {
    return $Call.ByID(1422152924, path, name);
}

/**
 * CreateTag 创建标签
 * @param {string} path
 * @param {string} name
 * @param {string} message
 * @returns {$CancellablePromise<void>}
 */
export function CreateTag(path, name, message) {
    return $Call.ByID(4209616956, path, name, message);
}

/**
 * DeleteBranch 删除本地分支
 * @param {string} path
 * @param {string} name
 * @param {boolean} force
 * @returns {$CancellablePromise<void>}
 */
export function DeleteBranch(path, name, force) {
    return $Call.ByID(580272035, path, name, force);
}

/**
 * DeleteRemoteBranch 删除远程分支
 * @param {string} path
 * @param {string} branch
 * @returns {$CancellablePromise<void>}
 */
export function DeleteRemoteBranch(path, branch) {
    return $Call.ByID(2626609049, path, branch);
}

/**
 * DeleteTag 删除标签（本地+远程）
 * @param {string} path
 * @param {string} name
 * @returns {$CancellablePromise<void>}
 */
export function DeleteTag(path, name) {
    return $Call.ByID(873653241, path, name);
}

/**
 * DiscardFiles 丢弃工作区指定文件的更改
 * @param {string} path
 * @param {string[]} files
 * @returns {$CancellablePromise<void>}
 */
export function DiscardFiles(path, files) {
    return $Call.ByID(382904301, path, files);
}

/**
 * FetchProject 拉取远程信息
 * @param {string} path
 * @returns {$CancellablePromise<string>}
 */
export function FetchProject(path) {
    return $Call.ByID(3541106829, path);
}

/**
 * GetAllProjectOverview 获取所有项目的概览状态
 * @returns {$CancellablePromise<$models.ProjectOverview[]>}
 */
export function GetAllProjectOverview() {
    return $Call.ByID(2453130151).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType4($result);
    }));
}

/**
 * GetAppSettings 获取应用设置
 * @returns {$CancellablePromise<config$0.Settings | null>}
 */
export function GetAppSettings() {
    return $Call.ByID(428589026).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType6($result);
    }));
}

/**
 * GetBranches 获取所有本地分支
 * @param {string} path
 * @returns {$CancellablePromise<$models.BranchInfo[]>}
 */
export function GetBranches(path) {
    return $Call.ByID(1686190192, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType8($result);
    }));
}

/**
 * GetCommitDiff 获取指定提交的 diff
 * @param {string} path
 * @param {string} hash
 * @returns {$CancellablePromise<string>}
 */
export function GetCommitDiff(path, hash) {
    return $Call.ByID(3678609798, path, hash);
}

/**
 * GetCommitFileDiff 获取指定提交中某个文件的 diff
 * @param {string} path
 * @param {string} hash
 * @param {string} filePath
 * @returns {$CancellablePromise<string>}
 */
export function GetCommitFileDiff(path, hash, filePath) {
    return $Call.ByID(880053428, path, hash, filePath);
}

/**
 * GetCommitFiles 获取指定提交中变更的文件列表
 * @param {string} path
 * @param {string} hash
 * @returns {$CancellablePromise<$models.CommitFileInfo[]>}
 */
export function GetCommitFiles(path, hash) {
    return $Call.ByID(2420707876, path, hash).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType10($result);
    }));
}

/**
 * GetCommitLog 获取提交历史
 * @param {string} path
 * @param {number} count
 * @returns {$CancellablePromise<$models.CommitLog[]>}
 */
export function GetCommitLog(path, count) {
    return $Call.ByID(1281870789, path, count).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType12($result);
    }));
}

/**
 * GetConflictFileContent 获取冲突文件内容（包含冲突标记）
 * @param {string} projectPath
 * @param {string} filePath
 * @returns {$CancellablePromise<string>}
 */
export function GetConflictFileContent(projectPath, filePath) {
    return $Call.ByID(298498517, projectPath, filePath);
}

/**
 * GetConflictFiles 获取冲突文件列表
 * @param {string} path
 * @returns {$CancellablePromise<$models.ConflictFileInfo[]>}
 */
export function GetConflictFiles(path) {
    return $Call.ByID(2446806137, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType14($result);
    }));
}

/**
 * GetFileContent 获取文件内容
 * @param {string} projectPath
 * @param {string} filePath
 * @returns {$CancellablePromise<string>}
 */
export function GetFileContent(projectPath, filePath) {
    return $Call.ByID(3085630035, projectPath, filePath);
}

/**
 * GetFileDiff 获取文件 diff
 * @param {string} projectPath
 * @param {string} filePath
 * @returns {$CancellablePromise<string>}
 */
export function GetFileDiff(projectPath, filePath) {
    return $Call.ByID(1694304929, projectPath, filePath);
}

/**
 * GetFileDiffStaged 获取已暂存文件的 diff
 * @param {string} projectPath
 * @param {string} filePath
 * @returns {$CancellablePromise<string>}
 */
export function GetFileDiffStaged(projectPath, filePath) {
    return $Call.ByID(2773256455, projectPath, filePath);
}

/**
 * GetGitGlobalConfig 获取 git 全局配置
 * @returns {$CancellablePromise<$models.GitConfig | null>}
 */
export function GetGitGlobalConfig() {
    return $Call.ByID(154811497).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType16($result);
    }));
}

/**
 * GetPlatformInfo 获取平台信息
 * @param {string} name
 * @returns {$CancellablePromise<$models.PlatformInfo | null>}
 */
export function GetPlatformInfo(name) {
    return $Call.ByID(2668095547, name).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType18($result);
    }));
}

/**
 * GetProjectChangedFiles 获取项目变更文件列表（可能较慢）
 * @param {string} path
 * @returns {$CancellablePromise<$models.FileInfo[]>}
 */
export function GetProjectChangedFiles(path) {
    return $Call.ByID(2302591462, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType20($result);
    }));
}

/**
 * GetProjectStatus 获取项目 git 状态
 * @param {string} path
 * @returns {$CancellablePromise<$models.ProjectStatus | null>}
 */
export function GetProjectStatus(path) {
    return $Call.ByID(3451089027, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType22($result);
    }));
}

/**
 * GetProjectTree 获取项目树，供前端侧边栏渲染
 * @returns {$CancellablePromise<$models.TreeNode[]>}
 */
export function GetProjectTree() {
    return $Call.ByID(651189689).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType24($result);
    }));
}

/**
 * GetRemoteBranches 获取远程分支列表
 * @param {string} path
 * @returns {$CancellablePromise<$models.BranchInfo[]>}
 */
export function GetRemoteBranches(path) {
    return $Call.ByID(994796370, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType8($result);
    }));
}

/**
 * GetStashList 获取贮藏列表
 * @param {string} path
 * @returns {$CancellablePromise<$models.StashInfo[]>}
 */
export function GetStashList(path) {
    return $Call.ByID(1948257945, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType26($result);
    }));
}

/**
 * GetTags 获取所有标签
 * @param {string} path
 * @returns {$CancellablePromise<$models.TagInfo[]>}
 */
export function GetTags(path) {
    return $Call.ByID(3979169621, path).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType28($result);
    }));
}

/**
 * GetUserInfo 获取用户信息
 * @param {string} platform
 * @param {string} username
 * @returns {$CancellablePromise<$models.UserInfo | null>}
 */
export function GetUserInfo(platform, username) {
    return $Call.ByID(2674655707, platform, username).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType30($result);
    }));
}

/**
 * InstallGit 下载并安装 Git
 * installDir: 用户选择的安装目录（Windows 有效）
 * @param {string} installDir
 * @returns {$CancellablePromise<void>}
 */
export function InstallGit(installDir) {
    return $Call.ByID(1052641569, installDir);
}

/**
 * IsMerging 检查是否处于合并状态
 * @param {string} path
 * @returns {$CancellablePromise<boolean>}
 */
export function IsMerging(path) {
    return $Call.ByID(693809703, path);
}

/**
 * MergeBranch 合并指定分支到当前分支
 * @param {string} path
 * @param {string} branch
 * @returns {$CancellablePromise<string>}
 */
export function MergeBranch(path, branch) {
    return $Call.ByID(278161076, path, branch);
}

/**
 * PullProject 拉取项目（当前分支）
 * @param {string} path
 * @returns {$CancellablePromise<string>}
 */
export function PullProject(path) {
    return $Call.ByID(4145813996, path);
}

/**
 * PushProject 推送项目（当前分支）
 * @param {string} path
 * @returns {$CancellablePromise<string>}
 */
export function PushProject(path) {
    return $Call.ByID(3887901113, path);
}

/**
 * PushTag 推送标签到远程
 * @param {string} path
 * @param {string} name
 * @returns {$CancellablePromise<void>}
 */
export function PushTag(path, name) {
    return $Call.ByID(1424810524, path, name);
}

/**
 * RemovePlatform 删除平台
 * @param {string} name
 * @returns {$CancellablePromise<void>}
 */
export function RemovePlatform(name) {
    return $Call.ByID(2222448051, name);
}

/**
 * RemoveProject 从指定平台/用户下删除项目
 * @param {string} platform
 * @param {string} username
 * @param {string} name
 * @returns {$CancellablePromise<void>}
 */
export function RemoveProject(platform, username, name) {
    return $Call.ByID(2748109581, platform, username, name);
}

/**
 * RemoveUser 从平台删除用户
 * @param {string} platform
 * @param {string} username
 * @returns {$CancellablePromise<void>}
 */
export function RemoveUser(platform, username) {
    return $Call.ByID(1409517275, platform, username);
}

/**
 * ResetProject 版本回滚（git reset）
 * mode: "hard"(丢弃所有更改), "soft"(保留更改到暂存区), "mixed"(保留更改到工作区)
 * @param {string} path
 * @param {string} hash
 * @param {string} mode
 * @returns {$CancellablePromise<void>}
 */
export function ResetProject(path, hash, mode) {
    return $Call.ByID(2061148684, path, hash, mode);
}

/**
 * ResolveConflictFile 将冲突文件标记为已解决
 * @param {string} path
 * @param {string[]} files
 * @returns {$CancellablePromise<void>}
 */
export function ResolveConflictFile(path, files) {
    return $Call.ByID(1893119072, path, files);
}

/**
 * RevertCommit 撤回指定提交（生成一个反向提交）
 * @param {string} path
 * @param {string} hash
 * @returns {$CancellablePromise<void>}
 */
export function RevertCommit(path, hash) {
    return $Call.ByID(1334788539, path, hash);
}

/**
 * SaveConflictFile 保存冲突文件内容（手动解决冲突后保存）
 * @param {string} projectPath
 * @param {string} filePath
 * @param {string} content
 * @returns {$CancellablePromise<void>}
 */
export function SaveConflictFile(projectPath, filePath, content) {
    return $Call.ByID(3340289161, projectPath, filePath, content);
}

/**
 * SearchCommitLog 搜索提交历史
 * @param {string} path
 * @param {string} keyword
 * @param {string} author
 * @param {number} maxCount
 * @returns {$CancellablePromise<$models.CommitLog[]>}
 */
export function SearchCommitLog(path, keyword, author, maxCount) {
    return $Call.ByID(2874450917, path, keyword, author, maxCount).then(/** @type {($result: any) => any} */(($result) => {
        return $$createType12($result);
    }));
}

/**
 * SelectDirectory 打开系统文件夹选择器，返回选中的路径
 * @returns {$CancellablePromise<string>}
 */
export function SelectDirectory() {
    return $Call.ByID(2318416763);
}

/**
 * SelectGitInstallDir 打开文件夹选择器让用户选择 Git 安装路径
 * @returns {$CancellablePromise<string>}
 */
export function SelectGitInstallDir() {
    return $Call.ByID(2941074074);
}

/**
 * @param {application$0.App | null} app
 * @returns {$CancellablePromise<void>}
 */
export function SetApplication(app) {
    return $Call.ByID(383695022, app);
}

/**
 * SetGitGlobalConfig 设置 git 全局配置
 * @param {string} name
 * @param {string} email
 * @returns {$CancellablePromise<void>}
 */
export function SetGitGlobalConfig(name, email) {
    return $Call.ByID(3875064981, name, email);
}

/**
 * StageAll 暂存所有变更文件
 * @param {string} path
 * @returns {$CancellablePromise<void>}
 */
export function StageAll(path) {
    return $Call.ByID(2344562461, path);
}

/**
 * StageFiles 暂存指定文件
 * @param {string} path
 * @param {string[]} files
 * @returns {$CancellablePromise<void>}
 */
export function StageFiles(path, files) {
    return $Call.ByID(4064506881, path, files);
}

/**
 * StashApply 应用贮藏（不删除）
 * @param {string} path
 * @param {number} index
 * @returns {$CancellablePromise<void>}
 */
export function StashApply(path, index) {
    return $Call.ByID(721583959, path, index);
}

/**
 * StashDrop 删除贮藏
 * @param {string} path
 * @param {number} index
 * @returns {$CancellablePromise<void>}
 */
export function StashDrop(path, index) {
    return $Call.ByID(3821556536, path, index);
}

/**
 * StashPop 应用贮藏并删除
 * @param {string} path
 * @param {number} index
 * @returns {$CancellablePromise<void>}
 */
export function StashPop(path, index) {
    return $Call.ByID(4117964460, path, index);
}

/**
 * StashSave 保存当前变更到贮藏
 * @param {string} path
 * @param {string} message
 * @returns {$CancellablePromise<void>}
 */
export function StashSave(path, message) {
    return $Call.ByID(1178263140, path, message);
}

/**
 * SwitchBranch 切换分支
 * @param {string} path
 * @param {string} branch
 * @returns {$CancellablePromise<void>}
 */
export function SwitchBranch(path, branch) {
    return $Call.ByID(4262224900, path, branch);
}

/**
 * UnstageAll 取消暂存所有文件
 * @param {string} path
 * @returns {$CancellablePromise<void>}
 */
export function UnstageAll(path) {
    return $Call.ByID(2417621882, path);
}

/**
 * UnstageFiles 取消暂存指定文件
 * @param {string} path
 * @param {string[]} files
 * @returns {$CancellablePromise<void>}
 */
export function UnstageFiles(path, files) {
    return $Call.ByID(3546473046, path, files);
}

/**
 * UpdateAppSettings 更新应用设置
 * @param {string} logLevel
 * @returns {$CancellablePromise<void>}
 */
export function UpdateAppSettings(logLevel) {
    return $Call.ByID(718820989, logLevel);
}

/**
 * UpdatePlatform 修改平台信息（base_url）
 * @param {string} name
 * @param {string} baseURL
 * @returns {$CancellablePromise<void>}
 */
export function UpdatePlatform(name, baseURL) {
    return $Call.ByID(3258014550, name, baseURL);
}

/**
 * UpdateUser 修改用户信息（用户名、token）
 * @param {string} platform
 * @param {string} oldUsername
 * @param {string} newUsername
 * @param {string} token
 * @returns {$CancellablePromise<void>}
 */
export function UpdateUser(platform, oldUsername, newUsername, token) {
    return $Call.ByID(1631729342, platform, oldUsername, newUsername, token);
}

// Private type creation functions
const $$createType0 = $models.BatchPullResult.createFrom;
const $$createType1 = $Create.Array($$createType0);
const $$createType2 = $models.GitStatus.createFrom;
const $$createType3 = $models.ProjectOverview.createFrom;
const $$createType4 = $Create.Array($$createType3);
const $$createType5 = config$0.Settings.createFrom;
const $$createType6 = $Create.Nullable($$createType5);
const $$createType7 = $models.BranchInfo.createFrom;
const $$createType8 = $Create.Array($$createType7);
const $$createType9 = $models.CommitFileInfo.createFrom;
const $$createType10 = $Create.Array($$createType9);
const $$createType11 = $models.CommitLog.createFrom;
const $$createType12 = $Create.Array($$createType11);
const $$createType13 = $models.ConflictFileInfo.createFrom;
const $$createType14 = $Create.Array($$createType13);
const $$createType15 = $models.GitConfig.createFrom;
const $$createType16 = $Create.Nullable($$createType15);
const $$createType17 = $models.PlatformInfo.createFrom;
const $$createType18 = $Create.Nullable($$createType17);
const $$createType19 = $models.FileInfo.createFrom;
const $$createType20 = $Create.Array($$createType19);
const $$createType21 = $models.ProjectStatus.createFrom;
const $$createType22 = $Create.Nullable($$createType21);
const $$createType23 = $models.TreeNode.createFrom;
const $$createType24 = $Create.Array($$createType23);
const $$createType25 = $models.StashInfo.createFrom;
const $$createType26 = $Create.Array($$createType25);
const $$createType27 = $models.TagInfo.createFrom;
const $$createType28 = $Create.Array($$createType27);
const $$createType29 = $models.UserInfo.createFrom;
const $$createType30 = $Create.Nullable($$createType29);
