export type AccelerometerInterval =
	'game' |
	'ui' |
	'normal'

export type AccelerometerErrorCode =
	601 |
	602 |
	603 |
	604 |
	701 |
	702 |
	703 |
	801 |
	802 |
	803 |
	804 |
	501 |
	502 |
	503 |
	901

export interface IAccelerometerError extends IUniError {
	errCode : AccelerometerErrorCode
}

export type AccelerometerSuccess = {
	errMsg ?: string | null
}

export type AccelerometerFail = IAccelerometerError
export type AccelerometerSuccessCallback = (res : AccelerometerSuccess) => void
export type AccelerometerFailCallback = (res : AccelerometerFail) => void
export type AccelerometerComplete = AccelerometerSuccess | AccelerometerFail
export type AccelerometerCompleteCallback = (res : AccelerometerComplete) => void

export type StartAccelerometerOptions = {
	interval ?: AccelerometerInterval | null
	success ?: AccelerometerSuccessCallback | null
	fail ?: AccelerometerFailCallback | null
	complete ?: AccelerometerCompleteCallback | null
}

export type StopAccelerometerOptions = {
	success ?: AccelerometerSuccessCallback | null
	fail ?: AccelerometerFailCallback | null
	complete ?: AccelerometerCompleteCallback | null
}

export type OnAccelerometerChangeCallbackResult = {
	x : number
	y : number
	z : number
}

export type OnAccelerometerChangeCallback = (result : OnAccelerometerChangeCallbackResult) => void

export interface Uni {
  /**
   * 监听加速度数据变化事件
   *
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#onaccelerometerchange
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#onaccelerometerchange
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/accelerometer.html#onaccelerometerchange
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "2.9.6",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
   */
	onAccelerometerChange(callback : OnAccelerometerChangeCallback) : void;
  /**
   * 监听加速度数据变化事件
   *
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#offaccelerometerchange
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#offaccelerometerchange
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/accelerometer.html#offaccelerometerchange
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "2.9.6",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "2.9.3",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
   */
	offAccelerometerChange(callback : OnAccelerometerChangeCallback) : void;
  /**
   * 开始监听加速度数据变化事件
   *
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#startaccelerometer
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#startaccelerometer
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/accelerometer.html#startaccelerometer
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "2.9.6",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "2.9.3",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
   */
	startAccelerometer(options ?: StartAccelerometerOptions | null) : void;
  /**
   * 停止监听加速度数据变化事件
   *
   * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#stopaccelerometer
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/accelerometer.html#stopaccelerometer
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/accelerometer.html#stopaccelerometer
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "2.9.6",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "2.9.6",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "2.9.3",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
   */
	stopAccelerometer(options ?: StopAccelerometerOptions | null) : void;
}
