type ObjectMap<Key extends string | number | symbol = any, Value = any> = {
    [key in Key]: Value
}

declare namespace defs {
    export class LoginVo {
        /** token */
        token?: string

        /** 用户 ID */
        userId?: string
    }

    export class MenuVo {
        /** 子权限 */
        children?: Array<defs.MenuVo>

        /** 组件 */
        component?: string

        /** 元数据 */
        meta?: ObjectMap<any, object>

        /** 名称 */
        name?: string

        /** 路径 */
        path?: string

        /** 重定向 */
        redirect?: string
    }

    export class PageParam {
        /** 当前页数 */
        pageNo?: number

        /** 分页条数 */
        pageSize?: number

        /** 排序字段 */
        sortField?: string

        /** 排序方向（ASC|DESC） */
        sortOrder?: 'ASC' | 'DESC'
    }

    export class PageVo<T0 = any> {
        /** 数据 */
        data?: Array<T0>

        /** 数据最新时间 */
        latest?: string

        /** 数据总数 */
        total?: number
    }

    export class PermissionVo {
        /** 子权限 */
        children?: Array<defs.PermissionVo>

        /** 组件 */
        component?: string

        /** 是否启用 */
        enable?: boolean

        /** 是否隐藏 */
        hidden?: boolean

        /** 图标 */
        icon?: string

        /** 主键 */
        id?: string

        /** 元数据 */
        meta?: ObjectMap<any, object>

        /** 名称 */
        name?: string

        /** 路径 */
        path?: string

        /** 父级ID */
        pid?: string

        /** 序号 */
        serial?: number

        /** 权限类型 */
        type?: 'DIR' | 'MENU' | 'BUTTON'

        /** 标识 */
        uid?: string
    }

    export class Result<T0 = any> {
        /** 内容 */
        body?: T0

        /** 业务标识码 */
        code?: number

        /** 详细信息 */
        details?: string

        /** 异常信息 */
        error?: string

        /** 消息 */
        message?: string

        /** 状态码 */
        status?: number

        /** 耗时 */
        times?: string

        /** 响应时间 */
        timestamp?: string
    }

    export class RoleVo {
        /** 主键 */
        id?: string

        /** 名称 */
        name?: string

        /** 权限 */
        permissions?: Array<defs.PermissionVo>

        /** 标识 */
        uid?: string
    }

    export class UserExtensionVo {
        /** 年龄 */
        age?: number

        /** 性别 */
        gender?: number
    }

    export class UserInfo {
        /** 头像 */
        avatar?: string

        /** 介绍 */
        desc?: string

        /** 用户主页 */
        homePath?: string

        /** 手机号 */
        mobile?: string

        /** 真实姓名 */
        realName?: string

        /** 角色 */
        roles?: Array<defs.RoleVo>

        /** 主键 */
        userId?: string

        /** 用户名 */
        username?: string
    }

    export class UserVo {
        /** 头像 */
        avatar?: string

        /** 最后登录时间 */
        createTime?: string

        /** 是否删除 */
        deleted?: boolean

        /** 邮箱 */
        email?: string

        /** 是否启用 */
        enabled?: boolean

        /** 主键 */
        id?: string

        /** 最后登录IP地址 */
        lastLoginIp?: string

        /** 最后登录时间 */
        lastLoginTime?: string

        /** 手机号 */
        mobile?: string

        /** 真实姓名 */
        realName?: string

        /** 职称 */
        title?: string

        /** 用户名 */
        username?: string
    }
}

namespace API {
    /**
     * 身份认证
     */
    export namespace auth {
        /**
         * 登录
         * /api/auth/login
         */
        export namespace login {
            export class Params {
                /** 账号(支持用户名/手机号/邮箱) */
                account: string
                /** 密码 */
                password: string
            }

            export type Response = defs.LoginVo

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 登出
         * /api/auth/logout
         */
        export namespace logout {
            export class Params {}

            export type Response = string

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 注册
         * /api/auth/register
         */
        export namespace register {
            export class Params {
                /** 头像 */
                avatar?: string
                /** 邮箱 */
                email?: string
                /** 是否启用 */
                enable?: boolean
                /** 简介 */
                introduction?: string
                /** 手机号 */
                mobile: string
                /** 密码 */
                password: string
                /** 真实姓名 */
                realName: string
                /** 用户名 */
                username: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 安全校验
         * /api/auth/safe
         */
        export namespace safe {
            export class Params {
                /** 密码 */
                password: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 检查登录
         * /api/auth/valid
         */
        export namespace valid {
            export class Params {}

            export type Response = boolean

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }

    /**
     * 示例
     */
    export namespace example {
        /**
         * Hello World
         * /api/example/
         */
        export namespace hello {
            export class Params {}

            export type Response = string

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 文件下载
         * /api/example/download
         */
        export namespace download {
            export class Params {}

            export type Response = any

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 测试失败
         * /api/example/fail
         */
        export namespace fail {
            export class Params {}

            export type Response = string

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 查询用户属性
         * /api/example/findUserExtensionInfo
         */
        export namespace findUserExtensionInfo {
            export class Params {}

            export type Response = defs.UserExtensionVo

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * JSON 传参
         * /api/example/json
         */
        export namespace json {
            export class Params {}

            export type Response = defs.PageVo<string>

            export const init: Response

            export function request(
                body: defs.PageParam,
                config?: http.RequestConfig<defs.PageParam>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 分页条件查询
         * /api/example/page
         */
        export namespace page {
            export class Params {
                /** 当前页数 */
                pageNo: number
                /** 分页条数 */
                pageSize: number
                /** 排序字段 */
                sortField?: string
                /** 排序方向（ASC|DESC） */
                sortOrder?: 'ASC' | 'DESC'
            }

            export type Response = defs.PageVo<string>

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }

    /**
     * 文件管理
     */
    export namespace file {
        /**
         * 文件下载
         * /api/common/file/download
         */
        export namespace download {
            export class Params {
                /** bucket */
                bucket: string
                /** object */
                object: string
            }

            export type Response = any

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 文件上传
         * /api/common/file/upload
         */
        export namespace upload {
            export class Params {}

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                form: FormData,
                config?: http.RequestConfig<Params | FormData>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * Base64 图片上传
         * /api/common/file/uploadBase64Image
         */
        export namespace uploadBase64Image {
            export class Params {
                /** Base64 图片信息 */
                base64Image: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }

    /**
     * 权限管理
     */
    export namespace permission {
        /**
         * 新增
         * /api/sys/permission/add
         */
        export namespace add {
            export class Params {
                /** 组件 */
                component?: string
                /** 是否启用 */
                enable?: boolean
                /** 是否隐藏 */
                hidden?: boolean
                /** 图标 */
                icon?: string
                /** 元数据 */
                meta?: string
                /** 名称 */
                name: string
                /** 路径 */
                path?: string
                /** 父级ID */
                pid?: string
                /** 重定向 */
                redirect?: string
                /** 序号 */
                serial?: number
                /** 权限类型 */
                type: 'DIR' | 'MENU' | 'BUTTON'
                /** 标识 */
                uid: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 删除
         * /api/sys/permission/deleted
         */
        export namespace deleted {
            export class Params {
                /** id */
                id: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 查询
         * /api/sys/permission/find
         */
        export namespace find {
            export class Params {
                /** id */
                id: string
            }

            export type Response = defs.PermissionVo

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 修改
         * /api/sys/permission/modify
         */
        export namespace modify {
            export class Params {
                /** 组件 */
                component?: string
                /** 是否启用 */
                enable?: boolean
                /** 是否隐藏 */
                hidden?: boolean
                /** 图标 */
                icon?: string
                /** id */
                id: string
                /** 元数据 */
                meta?: string
                /** 名称 */
                name: string
                /** 路径 */
                path?: string
                /** 父级ID */
                pid?: string
                /** 重定向 */
                redirect?: string
                /** 序号 */
                serial?: number
                /** 权限类型 */
                type: 'DIR' | 'MENU' | 'BUTTON'
                /** 标识 */
                uid: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 分页查询
         * /api/sys/permission/page
         */
        export namespace page {
            export class Params {
                /** 当前页数 */
                pageNo: number
                /** 分页条数 */
                pageSize: number
                /** 排序字段 */
                sortField?: string
                /** 排序方向（ASC|DESC） */
                sortOrder?: 'ASC' | 'DESC'
            }

            export type Response = defs.PageVo<defs.PermissionVo>

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 树结构查询
         * /api/sys/permission/tree
         */
        export namespace tree {
            export class Params {
                /** pid */
                pid?: string
            }

            export type Response = Array<defs.PermissionVo>

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }

    /**
     * 角色管理
     */
    export namespace role {
        /**
         * 新增
         * /api/sys/role/add
         */
        export namespace add {
            export class Params {
                /** 名称 */
                name: string
                /** 标识 */
                uid: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 分配权限
         * /api/sys/role/assign
         */
        export namespace assign {
            export class Params {
                /** id */
                id: string
                /** ids 多个以逗号分割 */
                ids: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 删除
         * /api/sys/role/deleted
         */
        export namespace deleted {
            export class Params {
                /** ids 多个以逗号分割 */
                ids: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 查询
         * /api/sys/role/find
         */
        export namespace find {
            export class Params {
                /** id */
                id: string
            }

            export type Response = defs.RoleVo

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 修改
         * /api/sys/role/modify
         */
        export namespace modify {
            export class Params {
                /** id */
                id: string
                /** 名称 */
                name: string
                /** 标识 */
                uid: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 分页查询
         * /api/sys/role/page
         */
        export namespace page {
            export class Params {
                /** 当前页数 */
                pageNo: number
                /** 分页条数 */
                pageSize: number
                /** 排序字段 */
                sortField?: string
                /** 排序方向（ASC|DESC） */
                sortOrder?: 'ASC' | 'DESC'
            }

            export type Response = defs.PageVo<defs.RoleVo>

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 选项查询
         * /api/sys/role/selector
         */
        export namespace selector {
            export class Params {}

            export type Response = Array<defs.RoleVo>

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }

    /**
     * 用户管理
     */
    export namespace user {
        /**
         * 分配角色
         * /api/sys/user/assign
         */
        export namespace assign {
            export class Params {
                /** id */
                id: string
                /** ids 多个以逗号分割 */
                ids: string
            }

            export type Response = string

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 分页查询
         * /api/sys/user/page
         */
        export namespace page {
            export class Params {
                /** 当前页数 */
                pageNo: number
                /** 分页条数 */
                pageSize: number
                /** 排序字段 */
                sortField?: string
                /** 排序方向（ASC|DESC） */
                sortOrder?: 'ASC' | 'DESC'
            }

            export type Response = defs.PageVo<defs.UserVo>

            export const init: Response

            export function request(
                params: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }

    /**
     * 用户信息
     */
    export namespace userView {
        /**
         * 获取用户菜单
         * /api/user/getMenuList
         */
        export namespace getMenuList {
            export class Params {}

            export type Response = Array<defs.MenuVo>

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 获取用户权限
         * /api/user/getPermCode
         */
        export namespace getPermCode {
            export class Params {}

            export type Response = Array<string>

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }

        /**
         * 获取登录用户信息
         * /api/user/getUserInfo
         */
        export namespace getUserInfo {
            export class Params {}

            export type Response = defs.UserInfo

            export const init: Response

            export function request(
                params?: Params,
                config?: http.RequestConfig<Params>,
                options?: http.RequestOptions,
            ): Promise<Response>
        }
    }
}
