import { CommonStorage, HttpResponse, HttpServer, IKeyVal, ResponseFilter, Event, CommonAuth } from '@kjts20/tool';

declare const sendErr: (...args: any[]) => void;
declare const error: (title: any, err?: any, callback?: any, waitTime?: any) => void;
declare const success: (title: any, cb?: any, timer?: any) => void;
declare const toast: (title: any, isShowIcon?: boolean) => void;
declare const confirm: (content: any, confirmText?: string, cancelText?: string, title?: string) => Promise<unknown>;
declare const alert: (content: any, confirmText?: string, title?: string) => Promise<unknown>;
declare const hideTabBar: () => void;
declare const customLoading: (title: string, time: any, callback?: any, maskStatus?: boolean) => void;
declare const loading: (title?: string, callback?: Function, time?: number, maskStatus?: boolean) => void;
declare const hideLoading: (time?: number) => void;
declare const querySelector: (componentThis: any, selector: any) => Promise<any[]>;
declare const getLoginCode: () => Promise<string>;
declare const isIos: () => boolean;
declare const checkUpdate: () => void;
declare const defaultVerision = "2.20.3";
/**
 * 获取当前版本
 */
declare const getCurSdkVersion: () => number;
declare const saveImageToPhotosAlbum: (src: any) => Promise<unknown>;
declare const getUserInfo: () => Promise<any>;
interface IGetUserResolve {
    code: string;
    encryptedData: string;
    iv: string;
    userInfo: string;
    signature: string;
    rawData: string;
}
/**
 * 检查设置并获取用户信息
 * @param language
 * @returns
 */
declare const checkSettingAndGetUserInfo: (language?: 'zh_CN' | 'en' | 'zh_TW') => Promise<IGetUserResolve>;
/**
 * 获取系统信息
 *
 * @returns
 */
declare const getSystemInfoSync: () => any;
/**
 * 设置系统参数
 */
declare const setSystemInfo: () => void;
/**
 * 获取系统信息
 *
 * @returns
 */
declare const getSystemInfo: () => any;
/**
 * px转rpx
 *
 * @param rpx
 * @returns
 */
declare const rpx2px: (rpx: any) => any;
/**
 * 重启小程序（无法重启就直接退出）
 *
 * @param path
 */
declare const restartMiniProgram: (path: string) => void;

declare const storage: CommonStorage;

/**
 * 请求配置
 */
declare const httpServerConfig: {
    setHeader(): {};
    responseIntercept(response: HttpResponse): HttpResponse<any>;
};
/**
 * 创建请求实例
 */
declare const httpServer: HttpServer;
/**
 * 初始化请求（系统启动时候需要调用）
 *
 * @param host
 * @param getTokenFunc
 * @returns
 */
declare const initHttpServer: (host: any) => HttpServer;

declare const setTabBar: (tabBar: any) => void;
/**
 * 设置路由
 * @param routes 路
 */
declare const setRoutes: (routes: any) => void;
declare const toTabbarPageList: () => any[];
declare const toTabbarList: () => any[];
declare const toTabbarIndexPath: () => string;
declare enum EUseApi {
    reLaunch = "reLaunch",
    redirectTo = "redirectTo",
    navigateTo = "navigateTo",
    switchTab = "switchTab"
}
type TPageHistory = WechatMiniprogram.Page.Instance<Record<string, any>, Record<string, any>>;
/**
 * 获取当前路径
 */
declare const getCurrentPage: () => TPageHistory;
/**
 * 获取在页面栈中存在的页面
 *
 * @param topOrder 页面栈顶排序（当前页面为0，上一级为1）
 */
declare const getExistPage: (topOrder?: number) => TPageHistory | null;
/**
 * 获取页面示例（在页面栈中的页面）
 * @param route
 * @returns
 */
declare const getPageInstance: (route: string) => Promise<WechatMiniprogram.Page.Instance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>>;
/**
 * 获取历史页面实例
 * @param delta
 * @returns
 */
declare const getHistoryPage: (delta?: number) => Promise<WechatMiniprogram.Page.Instance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>>;
/**
 * 获取不带参数的路径
 *
 * @param route 页面路径
 */
declare const getWithoutArgsRoute: (route: any) => any;
declare const isTabbarPage: (route?: any) => boolean;
declare const getTabbarPageIndex: (route?: any) => number;
interface IGotoOptions {
    type?: EUseApi;
    sendData?: ISendData;
}
interface ISendData {
    [key: string]: any;
}
declare const goto: (route: string, options?: object, other?: IGotoOptions) => Promise<unknown>;
declare const refresh: (options?: object | null, type?: EUseApi) => Promise<unknown>;
/**
 * 返回
 * @param delta 返回的级数
 * @returns
 */
declare const back: (delta?: any, sendData?: IKeyVal) => Promise<unknown>;
declare const routerIsExist: (router: any) => boolean;

declare const resFilter: ResponseFilter;

/**
 * 引入request
 * @param url 函数路径（跨分包的）
 * @param getRequest 获取请求方法
 * @returns
 */
declare const requirePromise: (url: any, getRequest: (res: any) => (...a: any[]) => Promise<any>) => (...args: any[]) => Promise<any>;
/**
 * 引入包（小程序内）
 * @param url 函数路径（跨分包的）
 * @returns
 */
declare const requirePackage: (url: any) => Promise<any>;

/**
 * 初始化蓝牙模块
 * @returns
 */
declare const openBluetoothAdapter: () => Promise<unknown>;
/**
 * 适配器状态
 */
interface IAdapterState {
    available: boolean;
    discovering: boolean;
    powered: boolean;
}
/**
 * 获取本机蓝牙适配器状态
 * @returns
 */
declare const getBluetoothAdapterState: () => Promise<IAdapterState>;
/**
 * 状态监听着
 */
type TStateListener = (status: string | number, msg: string, other?: any) => void;
/**
 * 设备列表
 */
interface IDeviceItem {
    RSSI: number;
    advertisServiceUUIDs?: Array<string>;
    deviceId: string;
    name: string;
}
/**
 * 获取蓝牙设备信息
 * @param stateListener 状态监听者
 * @returns
 */
declare const getBluetoothDevices: (stateListener?: TStateListener) => Promise<IDeviceItem[]>;
/**
 * 获取蓝牙设备（集成方法）
 * @param stateListener 状态监听者
 * @returns
 */
declare const getBleList: (stateListener?: TStateListener) => Promise<IDeviceItem[]>;
/**
 * 停止搜索
 */
declare const stopBluetoothDevicesDiscovery: () => void;
/**
 * 连接蓝牙
 * @param deviceId
 * @param stateListener
 * @returns
 */
declare const createBLEConnection: (deviceId: any, stateListener?: any) => Promise<unknown>;
/**
 * 获取蓝牙低功耗设备所有服务
 * @param deviceId
 * @param stateListener
 * @returns
 */
declare const getBLEDeviceServices: (deviceId: any, stateListener?: any) => Promise<{
    uuid: string;
    isPrimary: boolean;
}[]>;
/**
 * 能够使用的蓝牙子项
 */
interface ICanUseBleItem {
    deviceId: string;
    serviceId: string;
    characteristicId: string;
    write: boolean;
    notify: boolean;
    read: boolean;
}
/**
 * 获取蓝牙低功耗设备某个服务中所有特征 (characteristic)
 * @param deviceId
 * @param serviceId
 * @param stateListener
 * @returns
 */
declare const getBLEDeviceCharacteristics: (deviceId: any, serviceId: any, stateListener?: any) => Promise<ICanUseBleItem[]>;
/**
 *  连接蓝牙（集成）
 * @param deviceId
 * @param stateListener
 * @returns
 */
declare const connectBle: (deviceId: any, stateListener?: any) => Promise<ICanUseBleItem[]>;
type TBleSendFunc = (data: ArrayBuffer, successCb?: Function) => void;
/**
 * 发送数据（分包发送）
 * @param sendFunc
 * @param data
 * @param packageSize
 * @param stateListener
 * @returns
 */
declare const send2Ble: (sendFunc: TBleSendFunc, data: any, packageSize?: number, stateListener?: any) => Promise<unknown>;
/**
 * 向蓝牙低功耗设备特征值中写入二进制数据(必须设备的特征支持 write 才可以成功调用)
 *
 * @param deviceId
 * @param serviceId
 * @param characteristicId
 * @param value
 * @param stateListener
 * @returns
 */
declare const writeBLECharacteristicValue: (deviceId: any, serviceId: any, characteristicId: any, value: any, stateListener?: any) => Promise<unknown>;
/**
 * 发送数据(集成方法)
 * @param deviceId
 * @param serviceId
 * @param characteristicId
 * @param data
 * @param stateListener
 * @returns
 */
declare const sendData2Ble: (deviceId: any, serviceId: any, characteristicId: any, data: any, stateListener?: any) => Promise<unknown>;
/**
 * 查询打印机状态
 * n = 1：传送打印机状态
 * n = 2：传送脱机状态
 * n = 3：传送错误状态
 * n = 4：传送纸传感器状态
 *
 * @param deviceId
 * @param serviceId
 * @param characteristicId
 * @param data
 * @param stateListener
 */
declare const queryBleStatus: (deviceId: any, stateListener?: any) => void;

/**
 * 路由工具
 */
declare class RouteTools {
    /**
     * 设置信息
     */
    private settings;
    /**
     * 设置登录路径
     * @param path
     */
    setLoginPath(path: string): this;
    /**
     * 是否登录页面
     * @param pagePath 页面路径（不传入就是当前页面）
     * @returns
     */
    isLoginPage(pagePath?: string): boolean;
    /**
     * 跳转登录页面
     *
     * @param jumpType 跳转类型
     * @param queryOptions 请求参数
     * @param getDefaultOptions 获取默认选项
     * @returns
     */
    gotoLoginPage(jumpType?: EUseApi, queryOptions?: IKeyVal, getDefaultOptions?: (page: TPageHistory) => IKeyVal): boolean;
    /**
     * 跳转到首页
     * @returns
     */
    toIndex(): Promise<unknown>;
}
/**
 * 创建实例使用
 */
declare const routeTools: RouteTools;

/**
 * 获取系统事件
 * @returns
 */
declare const getSysEvent: () => Event;

// 公共用户
interface CommonUser {
    // id
    id: number;
    // 用户名
    username: string;
    // 用户id
    userId: number;
    // 用户信息
    user: UserResultVo;
    // 可用状态：1启用 0禁用
    status: number;
    // 备注
    remark: string;
    // 创建时间
    createTime: string;
    // 创建用户id
    createUserId: number;
    // 更新时间
    updateTime: string;
    // 更新用户id
    updateUserId: number;
    // 版本号
    version: number;
}

// 用户、登录、身份
interface UserIdentityLoginDto<TUser = any> {
    // 系统用户信息
    user: TUser;
    // token
    token: string;
    // 身份值
    identityKey: string;
    // 身份名字
    identityName: string;
}

// 【结果】系统-组织-客户
interface CustomerResultVo extends CommonUser {
    customerUuid: string;
}

// 【结果】系统-组织-商家-员工
interface StaffResultVo extends CommonUser {
    // 员工唯一ID
    staffUuid: string;
    // 商家id
    merchantId: number;
    // 商家uuid
    merchantUuid: string;
    // 商家名字
    merchantName: string;
    // 分店id
    branchId: number;
    // 分店uuid
    branchUuid: string;
    // 分店名字
    branchName: string;
    // 部门（使用逗号分开的id列表）
    department: string;
    // 默认商家：1是 0否
    defaultMerchant: number;
    // 来源
    source: string;
}

// 【登录】微信登陆授权
interface AuthLoginParamDto {
    // 微信登陆临时凭证（wx.login生成的code）
    code: string;
    // 用户信息加密字符串（wx.getUserInfo接口获取）
    encryptedData: string;
    // 加密算法的密钥（wx.getUserInfo接口获取）
    iv: string;
    // 用户信息（json字符串）
    userInfo?: string;
    // 用户昵称
    username?: string;
    // 用户头像
    avatarUrl?: string;
}

// 【结果】系统-基础-用户
interface UserResultVo {
    // id
    id: number;
    // 昵称
    username: string;
    // 用户真实姓名
    realname: string;
    // 头像
    avatarUrl: string;
    // 手机号
    phone: string;
    // 性别
    gender: number;
    // 简介
    description: string;
    // 生日
    birthday: string;
    // 当前身份
    curIdentity: string;
    // 可用状态：1启用 0禁用
    status: number;
    // 备注
    remark: string;
    // 创建时间
    createTime: string;
    // 创建用户id
    createUserId: number;
    // 更新时间
    updateTime: string;
    // 更新用户id
    updateUserId: number;
    // 版本号
    version: number;
}

// 【结果】系统-组织-商家
interface MerchantResultVo {
    // 管理员用户ID
    adminUserId: number;
    // 营业类目
    category: string;
    // 联系人
    contactsName: string;
    // 联系人电话
    contactsPhone: string;
    // 创建时间
    createTime: string;
    // 创建用户id
    createUserId: number;
    // 公司简介
    description: string;
    // 详细信息
    detail: MerchantDetailResultVo;
    // 详细地址
    detailAddress: string;
    // 到期时间
    expireTime: string;
    // id
    id: number;
    // 默认商家：1是 0否
    isDefault: number;
    // logo地址
    logoUrl: string;
    // 商家uuid
    merchantUuid: string;
    // 商家名字
    merchantName: string;
    // 社会统一信用代码
    creditCode: string;
    // 备注
    remark: string;
    // 设置json
    settingJson: string;
    // 入驻时间
    settledTime: string;
    // 简称
    shortName: string;
    // 可用状态：1启用 0禁用
    status: number;
    // 主题颜色：rgb
    themeColor: string;
    // 更新时间
    updateTime: string;
    // 更新用户id
    updateUserId: number;
    // 版本号
    version: number;
}

// 【结果】系统-组织-商家详细
interface MerchantDetailResultVo {
    // id
    id: number;
    // 商家id
    merchantId: number;
    // 商家uuid
    merchantUuid: string;
    // 省
    province: string;
    // 省份代码
    provinceCode: string;
    // 市
    city: string;
    // 城市代码
    cityCode: string;
    // 区
    area: string;
    // 区域代码
    areaCode: string;
    // 社会统一信用代码
    biCreditCode: string;
    // 营业执照-图片
    biImgUrl: string;
    // 营业执照-公司名字
    biName: string;
    // 营业执照-公司地址
    biAddress: string;
    // 营业执照中-经营范围
    biScope: string;
    // 营业执照-有效期
    biValidPeriod: string;
    // 法人-身份证姓名
    lpIdcardName: string;
    // 法人-身份证号码
    lpIdcardNo: string;
    // 法人-身份证地址
    lpIdcardAddress: string;
    // 法人-身份证开始时间
    lpIdcardStartTime: string;
    // 法人-身份证结束时间
    lpIdcardEndTime: string;
    // 法人-身份证-正面-图片
    lpIdcardFrondImgUrl: string;
    // 法人-身份证-反面-图片
    lpIdcardBackImgUrl: string;
    // 备注
    remark: string;
    // 创建时间
    createTime: string;
    // 创建用户id
    createUserId: number;
    // 更新时间
    updateTime: string;
    // 更新用户id
    updateUserId: number;
    // 版本号
    version: number;
}

// 【结果】系统-组织-商家-员工
interface MerchantStaffResultVo {
    // id
    id: number;
    // 员工唯一ID
    staffUuid: string;
    // 用户id
    userId: number;
    // 用户信息
    user: UserResultVo;
    // 用户名
    username: string;
    // 商家id
    merchantId: number;
    // 商家uuid
    merchantUuid: string;
    // 商家名字
    merchantName: string;
    // 分店id
    branchId: number;
    // 分店uuid
    branchUuid: string;
    // 分店名字
    branchName: string;
    // 部门（使用逗号分开的id列表）
    department: string;
    // 默认商家：1是 0否
    defaultMerchant: number;
    // 来源
    source: string;
    // 可用状态：1启用 0禁用
    status: number;
    // 备注
    remark: string;
    // 创建时间
    createTime: string;
    // 创建用户id
    createUserId: number;
    // 更新时间
    updateTime: string;
    // 更新用户id
    updateUserId: number;
    // 版本号
    version: number;
}

/**
 * 组织鉴权方法（完全按照核心模块的org模块定制）
 */

/**
 * 组织鉴权事件
 */
declare const ORG_AUTH_EVENT: {
    LOGIN_STATUS_CHANGE: string;
    LOGIN_INFO_CHANGE: string;
};
declare class OrgAuth<TUser extends CommonUser> {
    constructor();
    /**
     * 设置
     */
    private settings;
    /**
     * 系统鉴权
     */
    readonly sysAuth: CommonAuth<TUser>;
    /**
     * 设置api
     *
     * @param key api键
     * @param apiUrl api值
     * @returns
     */
    setApi(key: string, apiUrl: string): this;
    /**
     * 登录响应
     * @param loginPromise 登录/checkToken/注册返回的promise处理
     * @returns
     */
    loginResponse(loginPromise: Promise<HttpResponse<UserIdentityLoginDto<TUser>>>): Promise<UserIdentityLoginDto<any>>;
    /**
     * 清空信息
     */
    clear(): void;
    /**
     * 退出登录
     */
    logout(): Promise<any>;
    /**
     * 小程序检查登录状态（checkToken）
     */
    mpCheckToken(unifiedTask?: boolean): Promise<HttpResponse<UserIdentityLoginDto<TUser>>>;
    /**
     * 小程序授权登录
     * @param 登录加密信息
     * @returns
     */
    mpAuthLogin({ code, iv, encryptedData }: {
        code: any;
        iv: any;
        encryptedData: any;
    }): Promise<UserIdentityLoginDto<TUser>>;
    /**
     * 是否登录
     */
    isLogin(showTip?: boolean): boolean;
    /**
     * 获取token
     */
    getToken(): string;
    /**
     * 获取当前身份
     */
    curIdentityKey(): string | null;
    /**
     * 切换登录身份
     * @param identityKey 登录身份
     */
    changeLoginIdentity(identity: string): void;
    /**
     * 获取登录用户信息
     */
    getLoginUser(): UserResultVo;
    /**
     * 获取客户身份
     */
    getLoginCustomer(): CustomerResultVo;
    /**
     * 获取员工身份
     */
    getLoginStaff(): StaffResultVo;
    /**
     * 获取登录用户id
     */
    getLoginUserId(): number;
    /**
     * 获取商家
     */
    getMerchant(): Promise<MerchantResultVo>;
    /**
     * 获取商家列表
     * @returns
     */
    getMerchantList(): Promise<Array<MerchantResultVo>>;
    /**
     * 设置默认商家
     * @param merchantId
     */
    setDefaultMerchant(merchantId: any): Promise<boolean>;
    /**
     * 获取系统用户
     * @returns
     */
    getSysUser(): Promise<UserResultVo>;
    /**
     * 获取用户身份
     * @returns
     */
    getCustomer(): Promise<CustomerResultVo>;
    /**
     * 获取员工身份
     * @returns
     */
    getStaff(): Promise<MerchantStaffResultVo>;
    /**
     * 微信授权注册
     * @param param 微信小程序登录信息
     * @returns
     */
    mpAuthRegister(param: AuthLoginParamDto): Promise<UserIdentityLoginDto>;
}
/**
 * 创建实例进行提供服务
 */
declare const orgAuth: OrgAuth<CommonUser>;
/**
 * 是否登录
 *
 * @returns boolean
 */
declare const isLogin: () => boolean;
/**
 * 获取登录的用户（通用的用户信息）
 *
 * @returns UserResultVo
 */
declare const getLoginUser: () => UserResultVo;
/**
 * 登录用户是否有手机号
 *  返回说明：
 *      1、登录用户返回：true/false
 *      2、没有登录用户返回： undefined
 *  使用说明：
 *      需要严格判断类型
 *
 * @returns true/false ｜ undefined
 */
declare const loginUserIsHasPhone: () => boolean;
/**
 * 获取登录的用户id
 *
 * @returns 用户id
 */
declare const getLoginUserId: () => number;
/**
 * 获取登录的员工
 *
 * @returns StaffResultVo
 */
declare const getLoginStaff: () => StaffResultVo;
/**
 * 获取登录的客户
 *
 * @returns CustomerResultVo
 */
declare const getLoginCustomer: () => CustomerResultVo;

export { EUseApi, ORG_AUTH_EVENT, TPageHistory, alert, back, checkSettingAndGetUserInfo, checkUpdate, confirm, connectBle, createBLEConnection, customLoading, defaultVerision, error, getBLEDeviceCharacteristics, getBLEDeviceServices, getBleList, getBluetoothAdapterState, getBluetoothDevices, getCurSdkVersion, getCurrentPage, getExistPage, getHistoryPage, getLoginCode, getLoginCustomer, getLoginStaff, getLoginUser, getLoginUserId, getPageInstance, getSysEvent, getSystemInfo, getSystemInfoSync, getTabbarPageIndex, getUserInfo, getWithoutArgsRoute, goto, hideLoading, hideTabBar, httpServer, httpServerConfig, initHttpServer, isIos, isLogin, isTabbarPage, loading, loginUserIsHasPhone, openBluetoothAdapter, orgAuth, queryBleStatus, querySelector, refresh, requirePackage, requirePromise, resFilter, restartMiniProgram, routeTools, routerIsExist, rpx2px, saveImageToPhotosAlbum, send2Ble, sendData2Ble, sendErr, setRoutes, setSystemInfo, setTabBar, stopBluetoothDevicesDiscovery, storage, success, toTabbarIndexPath, toTabbarList, toTabbarPageList, toast, writeBLECharacteristicValue };
