export interface Uni {
  /**
   * getNetworkType()
   * @description
   * 获取网络类型
   * @param {GetNetworkTypeOptions} options
   * @return {void}
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/network.html#getnetworktype
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/get-network-type.html
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/get-network-type.html
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "3.9+"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.11"
   * 		},
   *    "harmony": {
   *      "osVer": "3.0",
   *      "uniVer": "4.24",
   *      "unixVer": "4.61",
   *      "unixVaporVer": "5.0"
   *    }
   * 	},
     *  "mp": {
     *    "weixin": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "4.41"
     *    },
     *    "alipay": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "baidu": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "toutiao": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "lark": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "qq": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "kuaishou": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "jd": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    }
     *  },
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   }
   * }
   * @example
   * ```typescript
   *   uni.getNetworkType({
   *     success(res){
   *       console.log(res);
   *     }
   *   });
   * ```
   */
  getNetworkType(options : GetNetworkTypeOptions) : void;
  /**
   * 监听网络状态变化
   *
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/network.html#onnetworkstatuschange
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/network-status-change.html
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/network-status-change.html
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81",
   *  			"unixUtsPlugin": "4.81"
   * 		},
   *    "harmony": {
   *      "osVer": "3.0",
   *      "uniVer": "4.24",
   *      "unixVer": "4.61",
   *      "unixVaporVer": "5.0"
   *    }
   * 	},
     *  "mp": {
     *    "weixin": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "4.41"
     *    },
     *    "alipay": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "baidu": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "toutiao": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "lark": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "qq": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "kuaishou": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "jd": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    }
     *  },
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   }
   * }
   */
  onNetworkStatusChange(listener : OnNetworkStatusChangeCallback) : number;
  /**
   * 取消监听网络状态变化
   *
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/network.html#offnetworkstatuschange
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/network-status-change.html
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/network-status-change.html
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81",
   *  			"unixUtsPlugin": "4.81"
   * 		},
   *    "harmony": {
   *      "osVer": "3.0",
   *      "uniVer": "4.24",
   *      "unixVer": "4.61",
   *      "unixVaporVer": "5.0"
   *    }
   * 	},
     *  "mp": {
     *    "weixin": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "4.41"
     *    },
     *    "alipay": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "baidu": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "toutiao": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "lark": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "qq": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "kuaishou": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "jd": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    }
     *  },
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   }
   * }
   */
  offNetworkStatusChange(listener ?: number | OnNetworkStatusChangeCallback | null) : void;
}

export type GetNetworkType = (options : GetNetworkTypeOptions) => void;
export type GetNetworkTypeSuccess = {
  /**
   * 网络类型
   */
  networkType : string
};
export type GetNetworkTypeSuccessCallback = (result : GetNetworkTypeSuccess) => void;
export type GetNetworkTypeFail = UniError;
export type GetNetworkTypeFailCallback = (result : GetNetworkTypeFail) => void;
export type GetNetworkTypeComplete = any;
export type GetNetworkTypeCompleteCallback = (result : GetNetworkTypeComplete) => void;
export type GetNetworkTypeOptions = {
  /**
   * 接口调用成功的回调函数
   * @defaultValue null
   */
  success ?: GetNetworkTypeSuccessCallback | null,
  /**
   * 接口调用失败的回调函数
   * @defaultValue null
   */
  fail ?: GetNetworkTypeFailCallback | null,
  /**
   * 接口调用结束的回调函数（调用成功、失败都会执行）
   * @defaultValue null
   */
  complete ?: GetNetworkTypeCompleteCallback | null
};
export type OnNetworkStatusChangeCallbackResult = {
  /**
   * 当前是否有网络连接
   *
   * @type boolean
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81"
   *  			"unixUtsPlugin": "4.81"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81",
   * 			"unixUtsPlugin": "4.81"
   * 		},
   *    "harmony": {
   *      "osVer": "3.0",
   *      "uniVer": "4.24",
   *      "unixVer": "4.61",
   *      "unixVaporVer": "5.0"
   *    }
   * 	},
     *  "mp": {
     *    "weixin": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "4.41"
     *    },
     *    "alipay": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "baidu": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "toutiao": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "lark": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "qq": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "kuaishou": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "jd": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    }
     *  },
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   }
   * }
   */
  isConnected : boolean,
  /**
   * 网络类型(wifi、2g、3g、4g、5g、unknown、none)
   *
   * @type boolean
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81"
   *  			"unixUtsPlugin": "4.81"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "√",
   * 			"unixVer": "4.81",
   * 			"unixUtsPlugin": "4.81"
   * 		},
   *    "harmony": {
   *      "osVer": "3.0",
   *      "uniVer": "4.24",
   *      "unixVer": "4.61",
   *      "unixVaporVer": "5.0"
   *    }
   * 	},
     *  "mp": {
     *    "weixin": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "4.41"
     *    },
     *    "alipay": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "baidu": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "toutiao": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "lark": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "qq": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "kuaishou": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    },
     *    "jd": {
     *        "hostVer": "√",
     *        "uniVer": "√",
     *        "unixVer": "x"
     *    }
     *  },
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   }
   * }
   */
  networkType : string
};
export type OnNetworkStatusChangeCallback = (result : OnNetworkStatusChangeCallbackResult) => void;
export type OnNetworkStatusChange = (listener : OnNetworkStatusChangeCallback) => number;
export type OffNetworkStatusChange = (listener ?: number | OnNetworkStatusChangeCallback | null) => void;
