
/**
  * @en Alarm
  * @zh 定时器
  */
declare module '@zos/alarm' {

  /**
   * @en Repeat once
   * @zh 重复一次
   * @version 3.0
   */
  const REPEAT_ONCE: number
  /**
   * @en Specify the repetition period as minute
   * @zh 指定重复周期为分钟
   * @version 3.0
   */
  const REPEAT_MINUTE: number
  /**
   * @en Specify the repetition period as hour
   * @zh 指定重复周期为小时
   * @version 3.0
   */
  const REPEAT_HOUR: number
  /**
   * @en Specify the repetition period as day
   * @zh 指定重复周期为天
   * @version 3.0
   */
  const REPEAT_DAY: number
  /**
   * @en Specify the repetition period as week
   * @zh 指定重复周期为周
   * @version 3.0
   */
  const REPEAT_WEEK: number
  /**
   * @en Specify the repetition period as month
   * @zh 指定重复周期为月
   * @version 3.0
   */
  const REPEAT_MONTH: number
  /**
   * @en Specify the repetition period as year
   * @zh 指定重复周期为年
   * @version 3.0
   */
  const REPEAT_YEAR: number
  /**
   * @en Monday
   * @zh 星期一
   * @version 3.0
   */
  const WEEK_MON: number
  /**
   * @en Tuesday
   * @zh 星期二
   * @version 3.0
   */
  const WEEK_TUE: number
  /**
   * @en Wednesday
   * @zh 星期三
   * @version 3.0
   */
  const WEEK_WED: number
  /**
   * @en Thursday
   * @zh 星期四
   * @version 3.0
   */
  const WEEK_THU: number
  /**
   * @en Friday
   * @zh 星期五
   * @version 3.0
   */
  const WEEK_FRI: number
  /**
   * @en Saturday
   * @zh 星期六
   * @version 3.0
   */
  const WEEK_SAT: number
  /**
   * @en Sunday
   * @zh 星期日
   * @version 3.0
   */
  const WEEK_SUN: number
  namespace set {
    interface Option {
      /**
       * @en App ID of the Mini Program, default current Mini Program ID
       * @zh 小程序的 App ID，默认当前小程序 ID
       */
      appid?: number
      /**
       * @en File path to wake up Mini Program, supporting App Service
       * @zh 唤醒小程序的文件路径，支持「设备应用服务」
       */
      url: string
      /**
       * @en Timer execution time, UTC timestamp, in seconds, this field has higher priority than `delay`, each call must pass one of the `time` and `delay` parameter
       * @zh 定时器执行的时间，UTC 时间戳，单位秒，该字段优先级高于 `delay`，每次调用必须传入 `time` 和 `delay` 其中的一个参数
       */
      time?: number
      /**
       * @en How many seconds of delay based on the current time after the execution, in seconds. Each call must pass one of the `time` and `delay` parameter
       * @zh 基于当前时间延迟多少秒后执行，单位秒，每次调用必须传入 `time` 和 `delay` 其中的一个参数
       */
      delay?: number
      /**
       * @en The argument passed to the app.js lifecycle `onCreate`
       * @zh 传递给 app.js 生命周期 `onCreate` 中的参数
       */
      param?: string
      /**
       * @en Does the timer need persistent storage (can still be executed successfully after device reboot)
       * @zh 定时器是否需要持久化存储（设备重启后依然能够成功执行）
       * @defaultValue false
       */
      store?: boolean
      /**
       * @en Timer repetition type, refer to timer periodic repetition constants
       * @zh 定时器的重复类型，参考定时器定期重复常量
       */
      repeat_type?: number
      /**
       * @defaultValue REPEAT_MINUTE
       * @en Effective when `repeat_type` is set to `REPEAT_MINUTE`, `REPEAT_HOUR`, `REPEAT_DAY`, used in conjunction with repeat_duration to set a repeat period, one repeat period in the current `repeat_type`, containing `repeat_period` times, and `repeat_duration` times before the reminder
       * @zh 当 `repeat_type` 设置为 `REPEAT_MINUTE`、`REPEAT_HOUR`、`REPEAT_DAY` 时生效，与 repeat_duration 配合使用，设置一个重复周期，一个重复周期以当前的 `repeat_type` 为单位，包含 `repeat_period` 次，提醒前 `repeat_duration` 次
       */
      repeat_period?: number
      /**
       * @defaultValue 1
       * @en When `repeat_type` is set to `REPEAT_MINUTE`, `REPEAT_HOUR`, `REPEAT_DAY`, the number of reminders in a period of the timer, used with `repeat_duration`, a period of the current `repeat_type`, including repeat_period times, `repeat_duration` times before the reminder
       * @zh 当 `repeat_type` 设置为 `REPEAT_MINUTE`、`REPEAT_HOUR`、`REPEAT_DAY` 时生效，定时器一个周期内提醒的次数，与 `repeat_duration` 配合使用，一个周期以当前的 `repeat_type` 为单位，包含 `repeat_period` 次，提醒前 `repeat_duration` 次
       */
      repeat_duration?: number
      /**
       * @en Effective when `repeat_type` is `REPEAT_WEEK`, you can customize which days of the week are repeated, refer to the timer week constants
       * @zh 当 `repeat_type` 为 `REPEAT_WEEK` 时生效，可以自定义一周内重复哪几天，参考定时器周常量
       */
      week_days?: number
      /**
       * @en The time when the repeat reminder starts, in UTC seconds, and the repeat reminder only takes effect during the repeat time period
       * @zh 重复提醒开始的时间，UTC 秒，重复提醒只在重复时间段内生效
       */
      start_time?: number
      /**
       * @en The time when the repeat reminder ends, in UTC seconds, and the repeat reminder only takes effect during the repeat time period
       * @zh 重复提醒结束的时间，UTC 秒，重复提醒只在重复时间段内生效
       */
      end_time?: number
    }

    /**
     * @en The id returned by the timer creation, `0` is an invalid ID, which means the timer creation failed, and the ID remains the same after the system restart for timers that support persistence
     * @zh 创建定时器返回的 id，`0` 为无效 ID，表示定时器创建失败，支持持久化的定时器在系统重启后，ID 仍保持不变
     */
    type Result = number
  }

  /**
   * @en Support for persistent timers to wake up pages of Mini Program
   * @zh 支持持久化的定时器，用来唤醒小程序的页面
   * @constants alarm_repeat,alarm_week
   * @permissionCode device:os.alarm
   * @version 3.0
   * @example
   * ```js
   * // At a certain time each day
   * import { set, REPEAT_DAY } from '@zos/alarm'
   *
   * const option = {
   *   url: 'pages/index.js',
   *   time: 12345678,
   *   repeat_type: REPEAT_DAY
   * }
   * const id = set(option)
   *
   * // Every Monday and Wednesday
   * import { set, REPEAT_WEEK, WEEK_MON, WEEK_WED } from '@zos/alarm'
   *
   * const option = {
   *   url: 'pages/index.js',
   *   time: 12345678,
   *   repeat_type: REPEAT_WEEK,
   *   week_days: WEEK_MON| WEEK_WED
   * }
   * const id = set(option)
   *
   * // Reminder every 21 days
   * import { set, REPEAT_DAY } from '@zos/alarm'
   *
   * const option = {
   *   url: 'pages/index.js',
   *   time: 12345678,
   *   repeat_type: REPEAT_DAY,
   *   repeat_period: 20,
   *   repeat_duration: 1,
   * }
   * const id = set(option)
   * ```
   */
  function set(option: set.Option): set.Result
  namespace cancel {
    interface Option {
      /**
       * @en Vertical axis coordinates of the page
       * @zh 定时器 ID，由 `set` 方法返回
       */
      id: number
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Cancels the set timer, if the timer is set to persist and also cancels the persistence
   * @zh 取消设置的定时器，如果定时器设置了持久化，同时取消持久化
   * @permissionCode device:os.alarm
   * @version 3.0
   * @example
   * ```js
   * import { cancel } from '@zos/alarm'
   *
   * cancel(id)
   * ```
   */
  function cancel(option: cancel.Option): cancel.Result
  function cancel(id: number): cancel.Result
  /**
   * @en Get an array of all created timers alarmId for the current Mini Program, including timers that support persistence
   * @zh 获取当前小程序所有已创建的定时器 alarmId 数组, 包括支持持久化的定时器
   * @permissionCode device:os.alarm
   * @version 3.0
   * @example
   * ```js
   * import { getAllAlarms } from '@zos/alarm'
   *
   * getAllAlarms()
   * ```
   */
  function getAllAlarms(): Array<number>
}

/**
  * @en Mini Program related
  * @zh 小程序
  */
declare module '@zos/app' {

  /**
   * @en In Mini Program
   * @zh 在小程序内
   */
  const SCENE_APP: number
  /**
   * @en In watchface interface
   * @zh 在表盘主界面
   */
  const SCENE_WATCHFACE: number
  /**
   * @en In the Mini Program configuration or dial edit page
   * @zh 在小程序配置或者表盘编辑页面
   */
  const SCENE_SETTINGS: number
  /**
   * @en In the rest screen screen
   * @zh 在息屏界面
   */
  const SCENE_AOD: number
  namespace getPackageInfo {
    /**
     * @en Please see the fields in `app.json` for more details
     * @zh 此处不一一列举，请参考 `app.json` 中字段
     */
    type Result = object
  }

  /**
   * @en Get some of the fields in the Mini Program configuration `app.json`
   * @zh 获取小程序配置 `app.json` 中的部分字段
   * @example
   * ```js
   * import { getPackageInfo } from '@zos/app'
   *
   * const packageInfo = getPackageInfo()
   * console.log(packageInfo.name)
   * ```
   */
  function getPackageInfo(): getPackageInfo.Result
  namespace getPackageInfoById {
    interface Option {
      /**
       * @en Mini Program ID
       * @zh 小程序 ID
       */
      appId: number
    }

    /**
     * @en Please see the fields in `app.json` for more details
     * @zh 此处不一一列举，请参考 `app.json` 中字段
     */
    type Result = object
  }

  /**
   * @en Get some of the fields in the Mini Program configuration `app.json` by app ID
   * @zh 根据小程序 ID 获取小程序配置 `app.json` 中的部分字段
   * @version 4.0
   * @example
   * ```js
   * import { getPackageInfoById } from '@zos/app'
   *
   * const packageInfo = getPackageInfoById({ appId: 1001 })
   * console.log(packageInfo.name)
   * ```
   */
  function getPackageInfoById(option: getPackageInfoById.Option): getPackageInfoById.Result
  namespace getScene {
    /**
     * @en The current scene in which the Mini Program is running, value reference scene constants
     * @zh 当前小程序运行的场景，值参考场景常量
     */
    type Result = number
  }

  /**
   * @en Get the current scene where the Mini Program is running
   * @zh 获取当前小程序运行的场景
   * @constants scene
   * @example
   * ```js
   * import { getScene, SCENE_APP } from '@zos/app'
   *
   * const result = getScene()
   *
   * if (result === SCENE_APP) {
   *   console.log('in Mini Program')
   * }
   * ```
   */
  function getScene(): getScene.Result
  namespace queryPermission {
    interface Option {
      /**
       * @en An array of permission strings, with an array length of at least `1`
       * @zh 权限字符串数组，数组长度至少为 `1`
       */
      permissions: Array<string>
    }

    /**
     * @en Permissions query result array, corresponding to the order of `permissions` array, `0`: not authorized, `1`: unknown permissions, `2`: authorized
     * @zh 权限查询结果数组，与 `permissions` 数组顺序一一对应，`0`: 未授权、`1`: 未知权限、`2`：已授权
     */
    type Result = Array<number>
  }

  /**
   * @en Check the authorization status of Mini Program permissions
   * @zh 查询小程序权限的授权状态
   * @version 3.0
   * @example
   * ```js
   * import { queryPermission } from '@zos/app'
   *
   * const result = queryPermission()
   * console.log(result)
   * ```
   */
  function queryPermission(option: queryPermission.Option): queryPermission.Result
  namespace requestPermission {
    interface Option {
      /**
       * @en An array of permission strings, with an array length of at least `1`
       * @zh 权限字符串数组，数组长度至少为 `1`
       */
      permissions: Array<string>
      /**
       * @en Permission request result callback function
       * @zh 权限申请结果回调函数
       */
      callback: (result: Array<number>) => void
    }

    /**
     * @en Method result value. See 'result' for a description
     * @zh 方法结果值，值描述见 `result`
     */
    type Result = number

    /**
     * @output
     * @enum
     */
    interface result {
      /**
       * @en In authorization processing, user interaction will be triggered, and the user will be informed of the authorization result in the callback function
       * @zh 授权处理中，将触发用户交互，并在回调函数中告知用户授权结果
       */
      0: number
      /**
       * @en There are no authorization requests that can be made
       * @zh 没有可以授权的权限
       */
      1: number
      /**
       * @en The requested interface is authorized and can be called immediately
       * @zh 所申请接口已经获得授权，可以立即调用
       */
      2: number
    }
  }

  /**
   * @en Dynamic permission application, when querying a dynamic permission has not been authorized, you can use this interface to apply for the relevant permission. Generally, before using the system-related functional interface (such as the interface to enable app services), do the relevant permission check and application, otherwise the functional interface will not be allowed to execute due to the permission issue
   * @zh 动态权限申请，当查询某个动态权限尚未授权时，可使用该接口申请相关权限。一般在使用系统相关功能接口（如启用设备应用服务的接口）前，做相关权限的检查和申请，否则功能接口会因权限问题不被允许执行
   * @version 3.0
   * @example
   * ```js
   * import { requestPermission } from '@zos/app'
   *
   * const result = requestPermission({
   *   permissions: ['device:os.bg_service'],
   *   callback: (result) => {
   *     console.log(result)
   *   }
   * })
   * console.log(result)
   * ```
   */
  function requestPermission(option: requestPermission.Option): requestPermission.Result
  namespace emitCustomSystemEvent {
    interface Option {
      /**
       * @en Customize event names that meet the naming convention of `event:customize.${event}`
       * @zh 自定义事件名称，需要满足 `event:customize.${event}` 的命名约定
       */
      eventName: string
      /**
       * @en Custom event parameters, this parameter is passed to the `onInit` lifecycle function of the `AppService` constructor
       * @zh 自定义事件参数，这个参数会传递到 `AppService` 构造函数的 `onInit` 生命周期函数中
       */
      eventParam: string
    }
  }

  /**
   * @en The Mini Program can customize the system events and can actively dispatch the custom system events
   * @zh 小程序可以自定义系统事件，并可以主动派发该自定义系统事件
   * @version 3.0
   * @example
   * ```js
   * import { emitCustomSystemEvent } from '@zos/app'
   *
   * emitCustomSystemEvent({
   *   eventName: 'event:customize.test',
   *   eventParam: 'eventName=event:customize.test&type=0'
   * })
   * ```
   */
  function emitCustomSystemEvent(option: emitCustomSystemEvent.Option): void
  namespace getPerformance {
    /**
     * @output
     * @en Profile statistics
     * @zh Profile 统计信息
     */
    interface Result {
      /**
       * @en Memory statistics
       * @zh 内存统计信息
       */
      memory?: Memory
      /**
       * @en Performance statistics
       * @zh 性能统计信息
       */
      perf?: Perf
    }

    /**
     * @output
     * @en Memory statistics
     * @zh 内存统计信息
     */
    interface Memory {
      /**
       * @en system memory information
       * @zh 系统内存信息
       */
      system: SystemMemory
      /**
       * @en Application memory information list
       * @zh 应用内存信息列表
       */
      app: Array<AppMemory>
      /**
       * @en Unreleased memory information list
       * @zh 未释放的内存信息列表
       */
      leaking: Array<LeakingMemory>
    }

    /**
     * @output
     * @en system memory information
     * @zh 系统内存信息
     */
    interface SystemMemory {
      /**
       * @en Used memory (bytes)
       * @zh 已用内存（字节）
       */
      used: number
      /**
       * @en Total memory (bytes)
       * @zh 内存总量（字节）
       */
      total: number
    }

    /**
     * @output
     * @en Application memory information
     * @zh 应用内存信息
     */
    interface AppMemory {
      /**
       * @en Mini Program ID
       * @zh 小程序 ID
       */
      appid?: number
      /**
       * @en Memory usage (bytes)
       * @zh 占用内存（字节）
       */
      used: number
      /**
       * @en Peak memory usage (bytes)
       * @zh 内存峰值（字节）
       */
      peak: number
      /**
       * @en Module memory information
       * @zh 模块内存信息
       */
      modules: Array<MemoryModule>
    }

    /**
     * @output
     * @en Unreleased memory information
     * @zh 未释放的内存信息
     */
    interface LeakingMemory {
      /**
       * @en Mini Program ID
       * @zh 小程序 ID
       */
      appid: number
      /**
       * @en Memory usage (bytes)
       * @zh 占用内存（字节）
       */
      used: number
      /**
       * @en Module memory information
       * @zh 模块内存信息
       */
      modules: Array<MemoryModule>
    }

    /**
     * @output
     * @en Memory profile information
     * @zh 内存统计信息
     */
    interface MemoryModule {
      /**
       * @en File path
       * @zh 文件路径
       */
      file: string
      /**
       * @en Memory usage (bytes)
       * @zh 占用内存（字节）
       */
      used: number
      /**
       * @en Peak memory usage (bytes)
       * @zh 内存峰值（字节）
       */
      peak: number
    }

    /**
     * @output
     * @en Performance statistics
     * @zh 性能统计信息
     */
    interface Perf {
      /**
       * @en Mini Program ID
       * @zh 小程序 ID
       */
      appid?: number
      /**
       * @en Module performance information list
       * @zh 模块性能信息列表
       */
      modules: Array<PerfModule>
    }

    /**
     * @output
     * @en Performance statistics module information
     * @zh 性能统计模块信息
     */
    interface PerfModule {
      /**
       * @en File name
       * @zh 文件名
       */
      file: string
      /**
       * @en File reading and running time (excluding lifecycle execution time)
       * @zh 文件读取和运行时间（不包含生命周期执行时间）
       */
      evalTime: number
      /**
       * @en onCreate lifecycle execution time
       * @zh onCreate 生命周期执行时间
       */
      createTime?: number
      /**
       * @en onInit lifecycle execution time
       * @zh onInit 生命周期执行时间
       */
      initTime?: number
      /**
       * @en build lifecycle execution time
       * @zh build 生命周期执行时间
       */
      buildTime?: number
    }
  }

  /**
   * @en Get  Mini Program performance statistics, including memory usage and loading performance metrics
   * @zh 获取小程序性能统计信息，包括内存占用和加载性能等指标
   * @version 4.0
   * @example
   * ```js
   * import { getPerformance } from '@zos/app'
   *
   * // Get memory info only
   * const memoryProfile = getPerformance('memory')
   *
   * // Get both memory and performance info
   * const fullProfile = getPerformance('memory', 'perf')
   * ```
   */
  function getPerformance(...args: Array<'memory' | 'perf'>): getPerformance.Result
}

/**
  * @en System App Access
  * @zh 系统 App 访问
  */
declare module '@zos/app-access' {

  namespace getSportData {
    interface Options {
      /**
       * @en Sports type, refer to the value of `SportType`
       * @zh 运动类型，取值参考 `SportType` 的值
       */
      type: string
    }

    /**
     * @output
     */
    interface CallbackResult {
      /**
       * @en Result status code, `0` means success, non- `0` means failure
       * @zh 结果状态码，`0` 表示成功，非 `0` 表示失败
       */
      code: number
      /**
       * @en Sports data, return value type is string, needs to be parsed using `JSON.parse`, the parsed type is `Array<object>`, the specific type of `object` can be referred to the `SportType` type description below, and the return value corresponding to each `type` is different
       * @zh 运动数据，返回值类型为字符串，需要使用 `JSON.parse` 进行解析，解析完的类型是 `Array<object>`，`object` 具体类型参考下文 `SportType` 类型说明，每一种 `type` 对应的返回值都不同
       */
      data: string
    }

    /**
     * @en If it returns `true`, it means the call was successful, otherwise the call failed
     * @zh 如果返回 `true` 说明调用成功，否则调用失败
     */
    type Result = boolean

    /**
     * @output
     * @enum
     */
    interface SportType {
      /**
       * @en Speed, example return value `{"speed": "9.99", "name": "Speed"}`
       * @zh 速度，示例返回值 `{"speed":"9.99", "name": "Speed"}`
       */
      speed: object
      /**
       * @en Average speed, example return value `{"avg_speed": "9.99", "name": "Average Speed"}`
       * @zh 平均速度，示例返回值 `{"avg_speed":"9.99", "name": "Average Speed"}`
       */
      avg_speed: object
      /**
       * @en Pace, example return value `{"avg_pace": "1' 12" "," name ":" Average Pace "}`
       * @zh 配速，示例返回值 `{"avg_pace":"1'12''", "name": "Average Pace"}`
       */
      pace: object
      /**
       * @en Average pace, example return value `{"avg_pace": "1'12'", "name": "Average Pace"}`
       * @zh 平均配速，示例返回值 `{"avg_pace":"1'12''", "name": "Average Pace"}`
       */
      avg_pace: object
      /**
       * @en Distance, example return value `{"distance": "9.99", "name": "Distance"}`
       * @zh 距离，示例返回值 `{"distance":"9.99", "name": "Distance"}`
       */
      distance: object
      /**
       * @en Time duration of workout, example return value `{"duration":"1:15:15", "name": "Duration"}`
       * @zh 运动用时，示例返回值 `{"duration":"1:15:15", "name": "Duration"}`
       */
      duration: object
      /**
       * @en Consumption, example return value `{"calories": "9.99", "name": "Calories"}`
       * @zh 消耗，示例返回值 `{"calories":"9.99", "name": "Calories"}`
       */
      calories: object
      /**
       * @en Cadence/cadence, example return value `{"cadence": "9.99", "name": "Cadence"}`
       * @zh 步频/踏频，示例返回值 `{"cadence":"9.99", "name": "Cadence"}`
       */
      cadence: object
      /**
       * @en Average cadence, example return value `{"avg_cadence": "9.99", "name": "Average Cadence"}`
       * @zh 平均步频/踏频，示例返回值 `{"avg_cadence":"9.99", "name": "Average Cadence"}`
       */
      avg_cadence: object
      /**
       * @en Altitude, example return value `{"altitude": "9.99", "name": "Elevation"}`
       * @zh 海拔，示例返回值 `{"altitude":"9.99", "name": "Elevation"}`
       */
      altitude: object
      /**
       * @en Accumulated elevation, example return value `{"total_up_altitude": "9.99", "name": "Total Ascent"}`
       * @zh 累计上升海拔，示例返回值 `{"total_up_altitude":"9.99", "name": "Total Ascent"}`
       */
      total_up_altitude: object
      /**
       * @en Total count, example return value `{"total_count": "9.99", "name": "Total count"}`
       * @zh 总计数，示例返回值 `{"total_count":"9.99", "name": "Total count"}`
       */
      total_count: object
      /**
       * @en Vertical Speed, example return value `{"vertical_speed": "9.99", "name": "Vertical Speed"}`
       * @zh 垂直速度，示例返回值 `{"vertical_speed":"9.99", "name": "Vertical Speed"}`
       */
      vertical_speed: object
      /**
       * @en Number of downhills, example return value `{"downhill_count": "9.99", "name": "Downhills"}`
       * @zh 滑降次数，示例返回值 `{"downhill_count":"9.99", "name": "Downhills"}`
       */
      downhill_count: object
      /**
       * @en Cumulative downhill distance, example return value `{"total_downhill_distance": "9.99", "name": "Total Downhill Distance"}`
       * @zh 累计滑降距离，示例返回值 `{"total_downhill_distance":"9.99", "name": "Total Downhill Distance"}`
       */
      total_downhill_distance: object
    }
  }

  /**
   * @en By default, the system will off the screen in one page of the Mini Program, and the system will exit the Mini Program after 10s, and enter the dial page when the watch is woken up again. If `relaunch` is set to `true`, the Mini Program will reopen and enter the corresponding page when the watch is woken up again
   * @zh 获取运动实时数据
   * @version 3.6
   * @permissionCode data:user.hd.workout
   * @example
   * ```js
   * import { getSportData } from '@zos/app-access'
   *
   * const result = getSportData({
   *   type: 'distance',
   * }, (callbackResult) => {
   *   const { code, data } = callbackResult
   *   if (code === 0) {
   *     const [{ distance }] = JSON.parse(data)
   *     console.log(distance)
   *   }
   * })
   * ```
   */
  function getSportData(
    options: getSportData.Options,
    callback: (callbackResult: getSportData.CallbackResult) => void,
  ): getSportData.Result
}

/**
  * @en App Service
  * @zh 设备应用服务
  */
declare module '@zos/app-service' {

  namespace start {
    interface Option {
      /**
       * @en The App Service js file must be the one configured in the module app-service in app.json
       * @zh 设备应用服务 js 文件，必须是在 app.json module 中 app-service 字段配置的文件
       */
      file: string
      /**
       * @en Parameters passed in when the js file is loaded by the backend service
       * @zh 设备应用服务 js 文件加载时，传入的参数
       */
      param?: string
      /**
       * @en Callback function for the completion of the backend service start
       * @zh 设备应用服务启动完成回调函数
       */
      complete_func: (callbackOption: CallbackOption) => void
      /**
       * @en Whether to persist and automatically restart following system running state changes. System state changes include: system restart, power saving mode entry/exit, system language changes, Mini Program updates, etc.
       * @zh 是否持久化，跟随系统运行状态变化自动重启。系统状态变化包括：系统重启，省电模式进出，系统语言变更，小程序更新等
       * @version 4.0
       * @defaultValue true
       */
      reload?: boolean
    }

    /**
     * @output
     */
    interface CallbackOption {
      /**
       * @en App service js file, same as `start` incoming parameters
       * @zh 设备应用服务 js 文件，与 `start` 传入参数相同
       */
      file: string
      /**
       * @en App service start result, `true` means success, `false` means failure
       * @zh 设备应用服务启动结果，`true` 代表成功，`false` 代表失败
       */
      result: boolean
    }

    /**
     * @en If the return value is `0`, it indicates that the device application service has been successfully started; for the meanings of other values, refer to ERROR_CODE
     * @zh 如果返回 `0` 则表明设备应用服务启动成功，其余值的含义参考 ERROR_CODE
     */
    type Result = boolean

    /**
     * @output
     * @enum
     */
    interface ERROR_CODE {
      /**
       * @en Success
       * @zh 成功
       */
      0: number
      /**
       * @en Parameter error
       * @zh 参数错误
       */
      1: number
      /**
       * @en Service Status Error
       * @zh 服务状态错误
       */
      2: number
      /**
       * @en No Permission
       * @zh 无权限
       */
      3: number
      /**
       * @en Out Of Memory
       * @zh 内存不足
       */
      4: number
      /**
       * @en Not Supported
       * @zh 不支持
       */
      5: number
      /**
       * @en Prohibited
       * @zh 服务被禁止
       */
      6: number
      /**
       * @en The number of services has reached the system limit
       * @zh 服务数量已达系统限制
       */
      7: number
      /**
       * @en Unknown Error
       * @zh 未知错误
       */
      255: number
    }
  }

  /**
   * @en Start the specified App service, return the result through the callback function
   * @zh 启动指定的设备应用服务，启动结果通过回调函数返回
   * @permissionCode device:os.bg_service
   * @version 3.0
   * @example
   * ```js
   * import { start } from '@zos/app-service'
   * ```
   */
  function start(option: start.Option): start.Result
  namespace stop {
    interface Option {
      /**
       * @en The App Service js file must be the one configured in the service module in app.json
       * @zh 设备应用服务 js 文件，必须是在 app.json 中 service module 中配置的文件
       */
      file: string
      /**
       * @en Callback function for the completion of the backend service stop
       * @zh 设备应用服务关闭完成回调函数
       */
      complete_func: (callbackOption: CallbackOption) => void
    }

    /**
     * @output
     */
    interface CallbackOption {
      /**
       * @en App service js file, same as `stop` incoming parameters
       * @zh 设备应用服务 js 文件，与 `stop` 传入参数相同
       */
      file: string
      /**
       * @en App service stop result, `true` means success, `false` means failure
       * @zh 设备应用服务关闭结果，`true` 代表成功，`false` 代表失败
       */
      result: boolean
    }

    /**
     * @en If `0` is returned, The App Service is closed successfully
     * @zh 如果返回 `0` 则表明设备应用服务关闭成功
     */
    type Result = boolean
  }

  /**
   * @en Shutdown the specified backend service, called asynchronously, with the shutdown result returned via a callback function
   * @zh 关闭指定的设备应用服务，异步调用，关闭结果通过回调函数返回
   * @permissionCode device:os.bg_service
   * @version 3.0
   * @example
   * ```js
   * import { stop } from '@zos/app-service'
   * ```
   */
  function stop(option: stop.Option): stop.Result
  namespace getAllAppServices {
    /**
     * @en Get the list of currently running App services
     * @zh 获取当前正在运行的设备应用服务列表
     */
    type Result = Array<string>
  }

  /**
   * @en Get the list of running App services, used to query the service status
   * @zh 获取当前应用在运行的设备应用服务列表，用于查询服务状态
   * @permissionCode device:os.bg_service
   * @version 3.0
   * @example
   * ```js
   * import { getAllAppServices } from '@zos/app-service'
   *
   * const serviceList = getAllAppServices()
   * console.log(serviceList)
   * ```
   */
  function getAllAppServices(): getAllAppServices.Result
  /**
   * @en Called in The App Service, it will exit the service and will not affect the foreground page
   * @zh 在设备应用服务中调用，会退出该服务，不会影响前台页面
   * @permissionCode device:os.bg_service
   * @version 3.0
   * @example
   * ```js
   * import { exit } from '@zos/app-service'
   *
   * exit()
   * ```
   */
  function exit(): void
}

/**
  * @en BLE
  * @zh BLE
  */
declare module '@zos/ble' {

  namespace mstStartScan {
    /**
     * @en Callback function for receiving scan results
     * @zh 接收扫描结果回调函数
     */
    type Callback = (result: ScanResult, filter?: Filter, timeout?: Timeout) => void

    /**
     * @output
     */
    interface ScanResult {
      /**
       * @en Device name
       * @zh 设备名称
       */
      dev_name: string
      /**
       * @en Device MAC address, 6 bytes long, Uint8Array view recommended
       * @zh 设备 MAC 地址，长度 6 字节，建议使用 Uint8Array 视图
       */
      dev_addr: ArrayBuffer
      /**
       * @en RSSI Signal Strength
       * @zh RSSI 信号强度
       */
      rssi: number
      /**
       * @en Service UUID array in broadcast data
       * @zh 广播数据中的 Service UUID 数组
       */
      service_uuid_array: Array<string>
      /**
       * @en Array of Service Data Objects in Broadcast Data
       * @zh 广播数据中的 Service 数据对象数组
       */
      service_data_array: Array<ServiceData>
    }

    /**
     * @output
     */
    interface ServiceData {
      /**
       * @en Service UUID
       * @zh Service UUID
       */
      uuid: string
      /**
       * @en Service data
       * @zh Service 数据
       */
      service_data: ArrayBuffer
    }

    interface Filter {
      /**
       * @en Device name
       * @zh 设备名称
       */
      device_name?: string
      /**
       * @en Whether to use fuzzy mode for device name matching
       * @zh 设备名称匹配是否采用模糊模式
       */
      fuzzy_mode?: string
      /**
       * @en Service UUID
       * @zh Service UUID
       */
      service_uuid?: string
      /**
       * @en Service data UUID
       * @zh Service 数据 UUID
       */
      service_data_uuid?: string
      /**
       * @en Manufacturer ID
       * @zh 设备商 ID
       */
      manufacturer_id?: number
    }

    interface Timeout {
      /**
       * @en Scanning duration, in seconds. Scanning automatically stops when the given duration is reached
       * @zh 扫描持续时长，单位秒。到给定的时长后，扫描自动停止
       */
      duration?: number
      /**
       * @en Callback function after scanning stops
       * @zh 扫描停止后的回调函数
       */
      on_timeout?: () => void
    }

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Scan and discover Bluetooth peripherals, which can be filtered according to filter conditions
   * @zh 扫描并发现蓝牙外围设备，可以根据 filter 条件进行过滤
   * @version 3.0
   * @example
   * ```js
   * import { mstStartScan } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstStartScan(
    callback: mstStartScan.Callback,
    filter?: mstStartScan.Filter,
  ): mstStartScan.Result
  namespace mstStopScan {
    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Stop device scanning, used in conjunction with `mstStartScan`
   * @zh 停止设备扫描，与 `mstStartScan` 配套使用
   * @version 3.0
   * @example
   * ```js
   * import { mstStopScan } from '@zos/ble'
   *
   * mstStopScan()
   * ```
   */
  function mstStopScan(): mstStopScan.Result
  namespace mstConnect {
    /**
     * @en Device MAC address, 6 bytes long, Uint8Array view recommended
     * @zh 设备 MAC 地址，长度 6 字节，建议使用 Uint8Array 视图
     */
    type DeviceAddress = ArrayBuffer

    /**
     * @en Connection result callback function
     * @zh 连接结果回调函数
     */
    type Callback = (result: ConnectResult) => void

    /**
     * @output
     */
    interface ConnectResult {
      /**
       * @en Connection status, `0` - successful connection, `1` - failed connection, `2` - disconnected
       * @zh 连接状态，`0` - 连接成功、`1` - 连接失败、`2` - 断连
       */
      connected: number
      /**
       * @en The ID of the connection is returned when the connection is successful
       * @zh 连接成功时返回连接的 ID
       */
      connect_id: number
      /**
       * @en Device MAC address, 6 bytes long, Uint8Array view recommended
       * @zh 设备 MAC 地址，长度 6 字节，建议使用 Uint8Array 视图
       */
      dev_addr: ArrayBuffer
    }

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Connecting Devices
   * @zh 连接设备
   * @version 3.0
   * @example
   * ```js
   * import { mstConnect } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstConnect(
    deviceAddress: mstConnect.DeviceAddress,
    callback: mstConnect.Callback,
  ): mstConnect.Result
  namespace mstDisconnect {
    /**
     * @en The connection ID returned when the connection is successful using the `mstConnect` API
     * @zh 使用 `mstConnect` API 连接成功时返回的连接 ID
     */
    type ConnectId = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Disconnecting devices
   * @zh 断开设备连接
   * @version 3.0
   * @example
   * ```js
   * import { mstDisconnect } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstDisconnect(connectId: mstDisconnect.ConnectId): mstDisconnect.Result
  namespace mstPair {
    /**
     * @en The connection ID returned when the connection is successful using the `mstConnect` API
     * @zh 使用 `mstConnect` API 连接成功时返回的连接 ID
     */
    type ConnectId = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Pairing with devices via `connectId`
   * @zh 通过 `connectId` 与设备进行配对
   * @version 3.0
   * @example
   * ```js
   * import { mstPair } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstPair(connectId: mstPair.ConnectId): mstPair.Result
  namespace mstGetConnIdByRemoteAddr {
    /**
     * @en Device MAC address, 6 bytes long, Uint8Array view recommended
     * @zh 设备 MAC 地址，长度 6 字节，建议使用 Uint8Array 视图
     */
    type DeviceAddress = ArrayBuffer

    /**
     * @en The result of the function call returns `connectId` for a successful query and `undefined` for a failed query.
     * @zh 函数调用结果，查询成功返回 `connectId`，查询失败返回 `undefined`
     */
    type Result = number | undefined
  }

  /**
   * @en Look up the connection Id based on the Peripheral MAC address
   * @zh 根据从机 MAC 地址查询连接 Id
   * @version 3.0
   * @example
   * ```js
   * import { mstGetConnIdByRemoteAddr } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstGetConnIdByRemoteAddr(
    deviceAddress: mstGetConnIdByRemoteAddr.DeviceAddress,
  ): mstGetConnIdByRemoteAddr.Result
  namespace mstBuildProfile {
    interface ProfileObj {
      /**
       * @en Whether to pair automatically
       * @zh 是否自动配对
       */
      pair: boolean
      /**
       * @en Connection ID
       * @zh 连接 ID
       */
      id: number
      /**
       * @en Profile Name
       * @zh Profile 名称
       */
      profile: string
      /**
       * @en Device MAC address, 6 bytes long, Uint8Array view recommended
       * @zh 设备 MAC 地址，长度 6 字节，建议使用 Uint8Array 视图
       */
      dev: ArrayBuffer
      /**
       * @en `list` array length
       * @zh `list` 数组长度
       */
      len: number
      /**
       * @en Services list array
       * @zh Services list 数组
       */
      list: Array<ServicesObj>
    }

    interface ServicesObj {
      /**
       * @en `list` array length
       * @zh `list` 数组长度
       */
      len: number
      /**
       * @en Service array
       * @zh Service 数组
       */
      list: Array<ServiceObj>
    }

    interface ServiceObj {
      /**
       * @en Service UUID
       * @zh Service UUID
       */
      uuid: string
      /**
       * @en Permission control, default `0` No control
       * @zh 权限控制，默认 `0` 不控制
       * @defaultValue 0
       */
      permission?: number
      /**
       * @en Characteristic array length
       * @zh Characteristic 数组长度
       */
      len1: number
      /**
       * @en Characteristic length
       * @zh Characteristic 数组
       */
      list: Array<CharacteristicObj>
    }

    interface CharacteristicObj {
      /**
       * @en Characteristic UUID
       * @zh Characteristic UUID
       */
      uuid: string
      /**
       * @en Permission control, default `0` No control
       * @zh 权限控制，默认 `0` 不控制
       * @defaultValue 0
       */
      permission?: number
      /**
       * @en Descriptor array length
       * @zh Descriptor 数组长度
       */
      len: number
      /**
       * @en Descriptor array
       * @zh Descriptor 数组
       */
      list: Array<DescriptorObj>
    }

    interface DescriptorObj {
      /**
       * @en Descriptor UUID
       * @zh Descriptor UUID
       */
      uuid: string
      /**
       * @en Permission control, default `0` No control
       * @zh 权限控制，默认 `0` 不控制
       * @defaultValue 0
       */
      permission?: number
    }

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Creating a Profile connection
   * @zh 创建 Profile 连接
   * @version 3.0
   * @example
   * ```js
   * import { mstGetConnIdByRemoteAddr } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstBuildProfile(profile: mstBuildProfile.ProfileObj): mstBuildProfile.Result
  namespace mstOnPrepare {
    /**
     * @en Listening to the prepare event callback function
     * @zh 监听 prepare 事件回调函数
     */
    type Callback = (profile: Profile, status: Status) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Status, `0` indicates success
     * @zh 状态，`0` 表示成功
     */
    type Status = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the prepare operation callback function
   * @zh 注册 prepare 操作回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnPrepare } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnPrepare(callback: mstOnPrepare.Callback): mstOnPrepare.Result
  namespace mstOnCharaReadComplete {
    /**
     * @en Read Characteristic Completion Callback Function
     * @zh 读取 Characteristic 完成回调函数
     */
    type Callback = (profile: Profile, uuid: UUID, status: Status) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Status, `0` indicates success
     * @zh 状态，`0` 表示成功
     */
    type Status = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the read Characteristic completion callback function
   * @zh 注册读取 Characteristic 完成回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnCharaReadComplete } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnCharaReadComplete(
    callback: mstOnCharaReadComplete.Callback,
  ): mstOnCharaReadComplete.Result
  namespace mstOnCharaValueArrived {
    /**
     * @en Read Characteristic data to the callback function
     * @zh 读取 Characteristic 数据到达回调函数
     */
    type Callback = (profile: Profile, uuid: UUID, data: Data, status: Status) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Reads the data using the Uint8Array view
     * @zh 读取到的数据，使用 Uint8Array 视图读取
     */
    type Data = ArrayBuffer

    /**
     * @en Status, `0` indicates success
     * @zh 状态，`0` 表示成功
     */
    type Status = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register to read Characteristic data to the callback function
   * @zh 注册读取 Characteristic 数据到达回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnCharaValueArrived } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnCharaValueArrived(
    callback: mstOnCharaValueArrived.Callback,
  ): mstOnCharaValueArrived.Result
  namespace mstOnCharaWriteComplete {
    /**
     * @en Write Characteristic Data Completion Callback Function
     * @zh 写入 Characteristic 数据完成回调函数
     */
    type Callback = (profile: Profile, uuid: UUID, status: Status) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Status, `0` indicates success
     * @zh 状态，`0` 表示成功
     */
    type Status = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the Write Characteristic data completion callback function
   * @zh 注册写入 Characteristic 数据完成回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnCharaWriteComplete } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnCharaWriteComplete(
    callback: mstOnCharaWriteComplete.Callback,
  ): mstOnCharaWriteComplete.Result
  namespace mstOnDescValueArrived {
    /**
     * @en Read Descriptor data to the callback function
     * @zh 读取 Descriptor 数据到达回调函数
     */
    type Callback = (
      profile: Profile,
      uuid: UUID,
      descUUID: DescUUID,
      data: Data,
      status: Status,
    ) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Descriptor UUID string
     * @zh Descriptor UUID 字符串
     */
    type DescUUID = string

    /**
     * @en Reads the data using the Uint8Array view
     * @zh 读取到的数据，使用 Uint8Array 视图读取
     */
    type Data = ArrayBuffer

    /**
     * @en Status, `0` indicates success
     * @zh 状态，`0` 表示成功
     */
    type Status = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the Read Descriptor data arrival callback function
   * @zh 注册读取 Descriptor 数据到达回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnDescValueArrived } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnDescValueArrived(
    callback: mstOnDescValueArrived.Callback,
  ): mstOnDescValueArrived.Result
  namespace mstOnDescWriteComplete {
    /**
     * @en Descriptor Data write completion callback function
     * @zh Descriptor 数据写入完成回调函数
     */
    type Callback = (profile: Profile, uuid: UUID, descUUID: DescUUID, status: Status) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Descriptor UUID string
     * @zh Descriptor UUID 字符串
     */
    type DescUUID = string

    /**
     * @en Status, `0` indicates success
     * @zh 状态，`0` 表示成功
     */
    type Status = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register Descriptor data write completion callback function
   * @zh 注册 Descriptor 数据写入完成回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnDescWriteComplete } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnDescWriteComplete(
    callback: mstOnDescWriteComplete.Callback,
  ): mstOnDescWriteComplete.Result
  namespace mstOnCharaNotification {
    /**
     * @en Characteristic Notification arrives at the callback function
     * @zh Characteristic Notification 到达回调函数
     */
    type Callback = (profile: Profile, uuid: UUID, data: Data, length: Length) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en It is recommended to use the Uint8Array view to read the data
     * @zh 读取到的数据，使用 Uint8Array 视图读取
     */
    type Data = ArrayBuffer

    /**
     * @en Data length
     * @zh 数据长度
     */
    type Length = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register Characteristic Notification to reach the callback function
   * @zh 注册 Characteristic Notification 到达回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnCharaNotification } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnCharaNotification(
    callback: mstOnCharaNotification.Callback,
  ): mstOnCharaNotification.Result
  namespace mstOnServiceChangeBegin {
    /**
     * @en Service start change callback function
     * @zh Service 开始变更回调函数
     */
    type Callback = (profile: Profile) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the Service start change callback function
   * @zh 注册 Service 开始变更回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnServiceChangeBegin } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnServiceChangeBegin(
    callback: mstOnServiceChangeBegin.Callback,
  ): mstOnServiceChangeBegin.Result
  namespace mstOnServiceChangeEnd {
    /**
     * @en Service change end callback function
     * @zh Service 变更结束回调函数
     */
    type Callback = (profile: Profile) => void

    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the Service change end callback function
   * @zh 注册 Service 变更结束回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnServiceChangeEnd } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstOnServiceChangeEnd(
    callback: mstOnServiceChangeEnd.Callback,
  ): mstOnServiceChangeEnd.Result
  /**
   * @en Unregister of all registered Bluetooth-related callback functions
   * @zh 注销所有注册的蓝牙相关回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOffAllCb } from '@zos/ble'
   *
   * mstOffAllCb()
   * ```
   */
  function mstOffAllCb(): void
  namespace mstPrepare {
    /**
     * @en The `profile` pointer returned by `mstBuildProfile`
     * @zh `mstBuildProfile` 返回的 `profile` 指针
     */
    type Profile = number
  }

  /**
   * @en prepare interface
   * @zh prepare 接口
   * @version 3.0
   * @example
   * ```js
   * import { mstPrepare } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstPrepare(profile: mstPrepare.Profile): void
  namespace mstReadCharacteristic {
    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string
  }

  /**
   * @en Read Characteristic information
   * @zh 读 Characteristic 信息
   * @version 3.0
   * @example
   * ```js
   * import { mstReadCharacteristic } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstReadCharacteristic(
    profile: mstReadCharacteristic.Profile,
    uuid: mstReadCharacteristic.UUID,
  ): void
  namespace mstWriteCharacteristic {
    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Reads the data using the Uint8Array view
     * @zh 读取到的数据，使用 Uint8Array 视图读取
     */
    type Data = ArrayBuffer

    /**
     * @en Data length
     * @zh 数据长度
     */
    type Length = number
  }

  /**
   * @en Write Characteristic information
   * @zh 写 Characteristic 信息
   * @version 3.0
   * @example
   * ```js
   * import { mstWriteCharacteristic } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstWriteCharacteristic(
    profile: mstWriteCharacteristic.Profile,
    uuid: mstWriteCharacteristic.UUID,
    data: mstWriteCharacteristic.Data,
    length: mstWriteCharacteristic.Length,
  ): void
  namespace mstReadDescriptor {
    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Descriptor UUID string
     * @zh Descriptor UUID 字符串
     */
    type DescUUID = string
  }

  /**
   * @en Write characteristic information
   * @zh 写 characteristic 信息
   * @version 3.0
   * @example
   * ```js
   * import { mstReadDescriptor } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstReadDescriptor(
    profile: mstReadDescriptor.Profile,
    uuid: mstReadDescriptor.UUID,
    descUUID: mstReadDescriptor.DescUUID,
  ): void
  namespace mstWriteDescriptor {
    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number

    /**
     * @en Characteristic UUID string
     * @zh Characteristic UUID 字符串
     */
    type UUID = string

    /**
     * @en Descriptor UUID string
     * @zh Descriptor UUID 字符串
     */
    type DescUUID = string

    /**
     * @en Reads the data using the Uint8Array view
     * @zh 读取到的数据，使用 Uint8Array 视图读取
     */
    type Data = ArrayBuffer

    /**
     * @en Data length
     * @zh 数据长度
     */
    type Length = number

    /**
     * @en The result of the function call, `true` means success, `false` means failure
     * @zh 函数调用结果，`true` 表示成功、`false` 表示失败
     */
    type Result = boolean
  }

  /**
   * @en Register the Characteristic notification arrival callback function
   * @zh 注册 Characteristic notification 到达回调函数
   * @version 3.0
   * @example
   * ```js
   * import { mstOnCharaNotification } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstWriteDescriptor(
    profile: mstWriteDescriptor.Profile,
    uuid: mstWriteDescriptor.UUID,
    descUUID: mstWriteDescriptor.DescUUID,
    data: mstWriteDescriptor.Data,
    length: mstWriteDescriptor.Length,
  ): mstWriteDescriptor.Result
  namespace mstDestroyProfileInstance {
    /**
     * @en Profile pointer
     * @zh Profile 指针
     */
    type Profile = number
  }

  /**
   * @en Destroy Profile
   * @zh 销毁 Profile
   * @version 3.0
   * @example
   * ```js
   * import { mstDestroyProfileInstance } from '@zos/ble'
   *
   * mstDestroyProfileInstance()
   * ```
   */
  function mstDestroyProfileInstance(profile: mstDestroyProfileInstance.Profile): void
  namespace mstGetProfileInstance {
    /**
     * @en Profile name
     * @zh Profile 名称
     */
    type ProfileName = string

    /**
     * @en The ID returned on a successful connection
     * @zh 连接成功时返回的 ID
     */
    type ConnectId = number

    /**
     * @en A successful search returns the Profile pointer, a failed search returns `undefined`
     * @zh 查找成功返回 Profile 指针，失败返回 `undefined`
     */
    type Result = number | undefined
  }

  /**
   * @en Query Profile pointer based on Profile name and connection ID
   * @zh 根据 Profile name 和连接 ID 查询 Profile 指针
   * @version 3.0
   * @example
   * ```js
   * import { mstGetProfileInstance } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function mstGetProfileInstance(
    profileName: mstGetProfileInstance.ProfileName,
    connectId: mstGetProfileInstance.ConnectId,
  ): mstGetProfileInstance.Result
  namespace createConnect {
    /**
     * @en Connection callback function, `index` packet number, `data` data, `size` data length
     * @zh 连接回调函数，`index` 分包号、`data` 数据、`size` 数据长度
     */
    type Callback = (index?: number, data?: object, size?: number) => void
  }

  /**
   * @en Create connection
   * @zh 创建连接
   * @example
   * ```js
   * import { createConnect } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function createConnect(callback: createConnect.Callback): void
  /**
   * @en Disconnect
   * @zh 断开连接
   * @example
   * ```js
   * import { disConnect } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function disConnect(): void
  /**
   * @en Send message, `data` data to be sent, `size` length of data to be sent
   * @zh 发送消息，`data` 待发送数据，`size` 待发送数据长度
   * @example
   * ```js
   * import { send } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function send(data: object, size: number): void
  /**
   * @en Query connection status, `true` means connected, `false` means not connected
   * @zh 查询连接状态，`true` 表示连接，`false` 表示未连接
   * @example
   * ```js
   * import { connectStatus } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function connectStatus(): boolean
  namespace addListener {
    /**
     * @en Connection callback function, `status` Connection status
     * @zh 连接回调函数，`status` 连接状态
     */
    type Callback = (status?: boolean) => void
  }

  /**
   * @en Registering connection status listening callback function
   * @zh 注册连接状态监听回调函数
   * @example
   * ```js
   * import { addListener } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function addListener(callback: addListener.Callback): void
  /**
   * @en Cancel connection status listening callback function
   * @zh 取消连接状态监听回调函数
   * @example
   * ```js
   * import { removeListener } from '@zos/ble'
   *
   * // ...
   * ```
   */
  function removeListener(): void
}

/**
  * @en Device
  * @zh 设备
  */
declare module '@zos/device' {

  /**
   * @en Square Screen
   * @zh 方形屏幕
   */
  const SCREEN_SHAPE_SQUARE: number
  /**
   * @en Round Screen
   * @zh 圆形屏幕
   */
  const SCREEN_SHAPE_ROUND: number
  namespace getDiskInfo {
    /**
     * @output
     */
    interface Result {
      /**
       * @en Total Space in bytes
       * @zh 总空间（字节）
       */
      total: number
      /**
       * @en Available Space in bytes
       * @zh 可用空间（字节）
       */
      free: number
      /**
       * @en Space occupied by Mini Programs in bytes
       * @zh 小程序占用空间（字节）
       */
      app: number
      /**
       * @en Space occupied by watchfaces in bytes
       * @zh 表盘占用空间（字节）
       */
      watchface: number
      /**
       * @en Space occupied by musics in bytes
       * @zh 音乐占用空间（字节）
       */
      music: number
      /**
       * @en Space occupied by system in bytes
       * @zh 系统占用空间（字节）
       */
      system: number
    }
  }

  /**
   * @en Gets disk information
   * @zh 获取磁盘信息
   * @example
   * ```js
   * import { getDiskInfo } from '@zos/device'
   *
   * const { total } = getDiskInfo()
   * console.log(total)
   * ```
   */
  function getDiskInfo(): getDiskInfo.Result
  namespace getDeviceInfo {
    /**
     * @output
     */
    interface Result {
      /**
       * @en Device screen width
       * @zh 设备屏幕宽度
       */
      width: number
      /**
       * @en Device screen height
       * @zh 设备屏幕高度
       */
      height: number
      /**
       * @en Screen shape, value refer to screen shape constants
       * @zh 屏幕形状，值参考屏幕形状常量
       */
      screenShape: number
      /**
       * @en Device name
       * @zh 设备名称
       */
      deviceName: number
      /**
       * @en Number of keys
       * @zh 按键数目
       */
      keyNumber: number
      /**
       * @en Device Plain Numeric Designators
       * @zh 设备纯数字代号
       */
      deviceSource: number
      /**
       * @en Device physical button type
       * @zh 设备实体按键类型
       */
      keyType: string
      /**
       * @en Device color identification
       * @zh 设备颜色标识
       */
      deviceColor: number
      /**
       * @en Device unique identifier, 32 bytes in length
       * @zh 设备唯一标识，长度 32 字节
       * @version 4.2
       */
      uuid: string
    }
  }

  /**
   * @en Gets device information
   * @zh 获取设备信息
   * @constants screenShape
   * @permissionCode data:os.device.info
   * @example
   * ```js
   * import { getDeviceInfo, SCREEN_SHAPE_SQUARE } from '@zos/device'
   *
   * const { width, screenShape } = getDeviceInfo()
   * console.log(width)
   *
   * if (screenShape === SCREEN_SHAPE_SQUARE) {
   *   console.log('Square Screen')
   * }
   * ```
   */
  function getDeviceInfo(): getDeviceInfo.Result
}

/**
  * @en Display
  * @zh 屏幕显示
  */
declare module '@zos/display' {

  namespace setWakeUpRelaunch {
    /**
     * @en `true` - auto-brightness is set to on, `false` - auto-brightness is set to off
     * @zh 如果类型为 `boolean` 参数含义为 `relaunch`，否则代表 Options 对象
     */
    type Option = Options | boolean

    interface Options {
      /**
       * @en Whether to reopen the Mini Program after waking up the watch again after a screen break
       * @zh 息屏后再次唤醒手表是否重新打开小程序
       */
      relaunch: boolean
    }
  }

  /**
   * @en By default, the system will off the screen in one page of the Mini Program, and the system will exit the Mini Program after 10s, and enter the dial page when the watch is woken up again. If `relaunch` is set to `true`, the Mini Program will reopen and enter the corresponding page when the watch is woken up again
   * @zh 默认情况下，在小程序某个页面中触发系统息屏，10s 后系统会退出该小程序，再次唤醒手表时进入表盘页面，如果设置 `relaunch` 为 `true`，再次唤醒手表后会重新打开小程序，并进入对应页面
   * @example
   * ```js
   * import { setWakeUpRelaunch } from '@zos/display'
   *
   * setWakeUpRelaunch({
   *   relaunch: true
   * })
   * ```
   */
  function setWakeUpRelaunch(option: setWakeUpRelaunch.Option): void
  function setWakeUpRelaunch(relaunch: boolean): void
  namespace setAutoBrightness {
    interface Option {
      /**
       * @en Whether to open the automatic brightness
       * @zh 是否开启自动亮度
       */
      autoBright: boolean
    }
  }

  /**
   * @en Set whether to turn on auto-brightness, if it is on, then the screen brightness will be controlled by the light sensor and the `setBrightness` will be disabled
   * @zh 设置是否开启自动亮度，如果开启，则屏幕亮度由光线传感器控制，`setBrightness` 的设置会失效
   * @example
   * ```js
   * import { setAutoBrightness } from '@zos/display'
   *
   * setAutoBrightness({
   *   autoBright: true
   * })
   * ```
   */
  function setAutoBrightness(option: setAutoBrightness.Option): void
  function setAutoBrightness(autoBright: boolean): void
  namespace getAutoBrightness {
    /**
     * @en `true` - auto-brightness is set to on, `false` - auto-brightness is set to off
     * @zh `true` - 自动亮度设置为开启状态，`false` - 自动亮度设置为关闭状态
     */
    type Result = boolean
  }

  /**
   * @en Get whether to turn on the screen auto brightness setting
   * @zh 获取是否开启屏幕自动亮度设置
   * @example
   * ```js
   * import { getAutoBrightness } from '@zos/display'
   *
   * const result = getAutoBrightness()
   *
   * if (result) {
   *   console.log('Auto brightness setting is turned on')
   * }
   * ```
   */
  function getAutoBrightness(): getAutoBrightness.Result
  namespace setBrightness {
    interface Option {
      /**
       * @en Screen brightness value, range 0 - 100
       * @zh 屏幕亮度数值，范围 0 - 100
       */
      brightness: number
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Set the screen brightness of the current device. If the auto brightness setting is currently turned on, the brightness is automatically adjusted by the light sensor, calling `setBrightness` will not take effect at this time, you need to use `setAutoBrightness` to turn off the auto brightness and then set it again. Note: If you exit the current page, you need to consider whether you need to set the brightness back to the original brightness
   * @zh 设置当前设备的屏幕亮度。如果当前开启了自动亮度设置，亮度由光线传感器自动调节，此时调用 `setBrightness` 不会生效，需要使用 `setAutoBrightness` 关闭自动亮度后再进行设置。注意事项：如果退出当前页面，需要考虑是否需要设置回原来的亮度
   * @example
   * ```js
   * import { setBrightness } from '@zos/display'
   *
   * const result = setBrightness({
   *   brightness: 50
   * })
   *
   * if (result === 0) {
   *   console.log('setBrightness success')
   * }
   * ```
   */
  function setBrightness(option: setBrightness.Option): setBrightness.Result
  function setBrightness(brightness: number): setBrightness.Result
  namespace getBrightness {
    /**
     * @en Screen brightness value, range 0 - 100
     * @zh 屏幕亮度数值，范围 0 - 100
     */
    type Result = number
  }

  /**
   * @en Get the screen brightness of the current device
   * @zh 获取当前设备的屏幕亮度
   * @example
   * ```js
   * import { getBrightness } from '@zos/display'
   *
   * const result = getBrightness()
   * console.log(`current brightness ${result}`)
   * ```
   */
  function getBrightness(): getBrightness.Result
  namespace setScreenOff {
    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Set the screen to rest
   * @zh 设置屏幕息屏
   * @example
   * ```js
   * import { setScreenOff } from '@zos/display'
   *
   * const result = setScreenOff()
   *
   * if (result === 0) {
   *   console.log('setScreenOff success')
   * }
   * ```
   */
  function setScreenOff(): setScreenOff.Result
  namespace setPageBrightTime {
    interface Option {
      /**
       * @en Screen lighting time (milliseconds), range [1000 - 2147483000]
       * @zh 亮屏时间（毫秒），范围 [1000 - 2147483000]
       * @defaultValue 10000
       */
      brightTime?: number
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Set the current page screen lighting time, this setting will follow the page destruction to do reset
   * @zh 设置当前页面屏幕亮屏时间，这个设置随页面销毁会做重置
   * @example
   * ```js
   * import { setPageBrightTime } from '@zos/display'
   *
   * const result = setPageBrightTime({
   *   brightTime: 60000
   * })
   *
   * if (result === 0) {
   *   console.log('setPageBrightTime success')
   * }
   * ```
   */
  function setPageBrightTime(option: setPageBrightTime.Option): setPageBrightTime.Result
  namespace resetPageBrightTime {
    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Cancel the bright time set by `setPageBrightTime`
   * @zh 取消 `setPageBrightTime` 设置的亮屏时间
   * @example
   * ```js
   * import { setPageBrightTime, resetPageBrightTime } from '@zos/display'
   *
   * setPageBrightTime({
   *   brightTime: 60000
   * })
   *
   * const result = resetPageBrightTime()
   * ```
   */
  function resetPageBrightTime(): resetPageBrightTime.Result
  namespace pausePalmScreenOff {
    interface Option {
      /**
       * @en Duration (milliseconds), if `0` is passed, the palm rest behavior is suspended until `resetPalmScreenOff` is called
       * @zh 持续时间（毫秒），如果传 `0`，则一直暂停覆掌息屏行为，直到调用 `resetPalmScreenOff`
       * @defaultValue 30000
       */
      duration?: number
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Suspension of overlapping palm resting screen behavior
   * @zh 暂停覆掌息屏行为
   * @version 2.1
   * @example
   * ```js
   * import { pausePalmScreenOff } from '@zos/display'
   *
   * pausePalmScreenOff({
   *   duration: 60000
   * })
   * ```
   */
  function pausePalmScreenOff(option: pausePalmScreenOff.Option): pausePalmScreenOff.Result
  namespace resetPalmScreenOff {
    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Recovery of overlapping palm resting screen behavior
   * @zh 恢复覆掌息屏行为
   * @version 2.1
   * @example
   * ```js
   * import { pausePalmScreenOff, resetPalmScreenOff } from '@zos/display'
   *
   * pausePalmScreenOff({
   *   duration: 0
   * })
   *
   * setTimeout(() => {
   *   resetPalmScreenOff()
   * }, 3000)
   * ```
   */
  function resetPalmScreenOff(): resetPalmScreenOff.Result
  namespace pauseDropWristScreenOff {
    interface Option {
      /**
       * @en Duration (milliseconds), if `0` is passed, the wrist rest behavior will be suspended until `resetPalmScreenOff` is called
       * @zh 持续时间（毫秒），如果传 `0`，则一直暂停落腕息屏行为，直到调用 `resetPalmScreenOff`
       * @defaultValue 30000
       */
      duration?: number
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Suspension of wrist resting behavior
   * @zh 暂停落腕息屏行为
   * @version 2.1
   * @example
   * ```js
   * import { pauseDropWristScreenOff } from '@zos/display'
   *
   * pauseDropWristScreenOff({
   *   duration: 60000
   * })
   * ```
   */
  function pauseDropWristScreenOff(
    option: pauseDropWristScreenOff.Option,
  ): pauseDropWristScreenOff.Result
  namespace resetDropWristScreenOff {
    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Resume wrist drop resting behavior
   * @zh 恢复落腕息屏行为
   * @version 2.1
   * @example
   * ```js
   * import { pauseDropWristScreenOff, resetDropWristScreenOff } from '@zos/display'
   *
   * pauseDropWristScreenOff({
   *   duration: 0
   * })
   *
   * setTimeout(() => {
   *   resetDropWristScreenOff()
   * }, 3000)
   * ```
   */
  function resetDropWristScreenOff(): resetDropWristScreenOff.Result
  namespace getSettings {
    /**
     * output
     */
    interface Result {
      /**
       * @en Screen Status
       * @zh 屏幕状态
       */
      screen: ScreenObj
      /**
       * @en Lift wrist to view info setting
       * @zh 抬腕亮屏设置
       */
      wrist: WristObj
      /**
       * @en Rest screen display settings
       * @zh 息屏显示设置
       */
      standby: StandbyObj
    }

    /**
     * output
     */
    interface ScreenObj {
      /**
       * @en Current screen status, `1`: On, `2`: Off
       * @zh 当前屏幕状态，`1`: 亮屏、`2`: 息屏
       */
      status: number
      /**
       * @en Screen light-up time, in seconds
       * @zh 屏幕亮屏时长，单位秒
       */
      duration: number
    }

    interface WristObj {
      /**
       * @en Response speed
       * @zh 抬腕亮屏响应速度
       */
      speed: number
      /**
       * @en Mode, see `model` for value
       * @zh 抬腕亮屏开启模式，值见 `model`
       */
      model: number
      /**
       * @en Start time, based on the number of minutes at 0:00 of the day
       * @zh 抬腕亮屏开启时间，基于当天 0 点的分钟数
       */
      startTime: number
      /**
       * @en End time, based on the number of minutes at 0:00 of the day
       * @zh 抬腕亮屏结束时间，基于当天 0 点的分钟数
       */
      endTime: number
    }

    interface StandbyObj {
      /**
       * @en Rest screen Watchface style, `0`: system default, `1`: follow the current dial
       * @zh 息屏表盘样式，`0`: 系统默认、`1`: 跟随当前表盘
       */
      style: number
      /**
       * @en Mode, see `model` for value
       * @zh 息屏显示开启模式，值见 model
       */
      model: number
      /**
       * @en Start time, based on the number of minutes at 0:00 of the day
       * @zh 息屏显示开启时间，基于当天 0 点的分钟数
       */
      startTime: number
      /**
       * @en End time, based on the number of minutes at 0:00 of the day
       * @zh 息屏显示结束时间，基于当天 0 点的分钟数
       */
      endTime: number
    }

    /**
     * @output
     * @enum
     */
    interface mode {
      /**
       * @en Measurement invalid
       * @zh 关闭
       */
      0: number
      /**
       * @en Measurement invalid
       * @zh 定时开启
       */
      1: number
      /**
       * @en Measurement invalid
       * @zh 全天开启
       */
      2: number
      /**
       * @en Measurement invalid
       * @zh 智能开启
       */
      3: number
    }
  }

  /**
   * @en Get system display related information
   * @zh 获取系统显示相关信息
   * @version 3.0
   * @example
   * ```js
   * import { getSettings } from '@zos/display'
   *
   * console.log(getSettings())
   * ```
   */
  function getSettings(): getSettings.Result
}

/**
  * @en File System
  * @zh 文件系统
  */
declare module '@zos/fs' {

  /**
   * @en Flag indicating to open a file for read-only access
   * @zh 指示打开文件以进行只读访问的标志
   */
  const O_RDONLY: number
  /**
   * @en Flag indicating to open a file for write-only access
   * @zh 指示打开文件以进行只写访问的标志
   */
  const O_WRONLY: number
  /**
   * @en Flag indicating to open a file for read-write access
   * @zh 指示打开文件以进行读写访问的标志
   */
  const O_RDWR: number
  /**
   * @en Flag indicating that data will be appended to the end of the file
   * @zh 指示数据将追加到文件末尾的标志
   */
  const O_APPEND: number
  /**
   * @en Flag indicating to create the file if it does not already exist
   * @zh 如果文件不存在则指示创建文件的标志
   */
  const O_CREAT: number
  /**
   * @en Flag indicating that opening a file should fail if the `O_CREAT` flag is set and the file already exists
   * @zh 如果设置了 `O_CREAT` 标志并且文件已经存在，则指示打开文件应该失败的标志
   */
  const O_EXCL: number
  /**
   * @en Flag indicating that if the file exists and the file is opened successfully for write access, its length shall be truncated to zero
   * @zh 标志表示如果文件存在并且该文件被成功打开以进行写访问，则其长度应被截断为零
   */
  const O_TRUNC: number
  namespace openSync {
    interface Option {
      /**
       * @en path
       * @zh 文件路径
       */
      path: string
      /**
       * @en Value refer to file open constants
       * @zh 值参考文件打开的常量
       * @defaultValue O_RDONLY
       */
      flag?: number
      /**
       * @en Other Options
       * @zh 其他选项
       * @version 3.0
       */
      options?: Options
    }

    interface Options {
      /**
       * @en Mini Program ID, you can open the file in the `/data` directory of the Mini Program with the corresponding ID
       * @zh 小程序 ID，可以打开对应 ID 小程序 `/data` 目录下的文件
       * @version 3.0
       */
      appId?: number
    }

    /**
     * @en The numeric file descriptor
     * @zh 文件句柄
     */
    type Result = number
  }

  /**
   * @en Open the file in the `/data` directory of the Mini Program synchronously and get the file handle
   * @zh 同步地打开小程序 `/data` 目录下的文件，获取文件句柄
   * @constants open
   * @example
   * ```js
   * import { openSync, O_RDONLY } from '@zos/fs'
   *
   * const fd = openSync({
   *   path: 'test.txt',
   *   flag: O_RDONLY
   * })
   * ```
   */
  function openSync(option: openSync.Option): openSync.Result
  namespace openAssetsSync {
    interface Option {
      /**
       * @en path
       * @zh 文件路径
       */
      path: string
      /**
       * @en Value refer to file open constants
       * @zh 值参考文件打开的常量
       * @defaultValue O_RDONLY
       */
      flag?: number
    }

    /**
     * @en The numeric file descriptor
     * @zh 文件句柄
     */
    type Result = number
  }

  /**
   * @en Open the file in the `/assets` directory of the Mini Program synchronously and get the file handle
   * @zh 同步地打开小程序 `/assets` 目录下的文件，获取文件句柄
   * @constants open
   * @example
   * ```js
   * import { openSync, O_RDONLY } from '@zos/fs'
   *
   * const fd = openAssetsSync({
   *   path: 'test.txt',
   *   flag: O_RDONLY
   * })
   * ```
   */
  function openAssetsSync(option: openAssetsSync.Option): openAssetsSync.Result
  namespace statSync {
    interface Option {
      /**
       * @en path
       * @zh 路径
       */
      path: string
    }

    /**
     * @en If `undefined` is returned, the target file does not exist, otherwise the file information object is returned
     * @zh 如果返回 `undefined` 则目标文件不存在，否则返回文件信息对象
     */
    type Result = FSStat | undefined

    /**
     * @output
     */
    interface FSStat {
      /**
       * @en The size of the file in bytes
       * @zh 文件大小（单位为字节）
       */
      size: number
    }
  }

  /**
   * @en Get information about the files in the `/data` directory of the Mini Program synchronously
   * @zh 同步地获取小程序 `/data` 目录下的文件信息
   * @example
   * ```js
   * import { statSync } from '@zos/fs'
   *
   * const result = statSync({
   *   path: 'test.txt',
   * })
   *
   * if (result) {
   *   const { size } = result
   *   console.log(size)
   * }
   * ```
   */
  function statSync(option: statSync.Option): statSync.Result
  namespace statAssetsSync {
    interface Option {
      /**
       * @en path
       * @zh 路径
       */
      path: string
    }

    /**
     * @en If `undefined` is returned, the target file does not exist, otherwise the file information object is returned
     * @zh 如果返回 `undefined` 则目标文件不存在，否则返回文件信息对象
     */
    type Result = FSStat | undefined

    /**
     * @output
     */
    interface FSStat {
      /**
       * @en The size of the file in bytes
       * @zh 文件大小（单位为字节）
       */
      size: number
    }
  }

  /**
   * @en Synchronously gets information about the files in the Mini Program `/assets` directory
   * @zh 同步地获取小程序 `/assets` 目录下的文件信息
   * @example
   * ```js
   * import { statAssetsSync } from '@zos/fs'
   *
   * const result = statAssetsSync({
   *   path: 'test.txt',
   * })
   *
   * if (result) {
   *   const { size } = result
   *   console.log(size)
   * }
   * ```
   */
  function statAssetsSync(option: statAssetsSync.Option): statAssetsSync.Result
  namespace closeSync {
    interface Option {
      /**
       * @en File handle, returned by the `openSync`, `openAssetsSync` and other APIs
       * @zh 文件句柄，由 `openSync`、`openAssetsSync` 等 API 返回
       */
      fd: number
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Close the file handle synchronously
   * @zh 同步地关闭文件句柄
   * @example
   * ```js
   * import { openSync, closeSync, O_RDONLY } from '@zos/fs'
   *
   * const fd = openSync({
   *   path: 'test.txt',
   *   flag: O_RDONLY
   * })
   * const result = closeSync({
   *   fd
   * })
   *
   * if (result === 0) {
   *   console.log('file descriptor closed')
   * }
   * ```
   */
  function closeSync(option: closeSync.Option): closeSync.Result
  function closeSync(fd: number): closeSync.Result
  namespace readSync {
    interface Option {
      /**
       * @en File handle, returned by the `openSync`, `openAssetsSync` and other APIs
       * @zh 文件句柄，由 `openSync`、`openAssetsSync` 等 API 返回
       */
      fd: number
      /**
       * @en The ArrayBuffer that the data will be written to
       * @zh 数据将写入的 ArrayBuffer
       */
      buffer: ArrayBuffer
      /**
       * @en Other Options
       * @zh 其他选项
       */
      options?: Options
    }

    interface Options {
      /**
       * @en The position in buffer to write the data to
       * @zh 要写入数据的 buffer 中的位置
       * @defaultValue 0
       */
      offset?: number
      /**
       * @en The number of bytes to read, the default is the number of bytes passed into the buffer
       * @zh 读取的字节数，默认为传入 buffer 的字节长度
       * @defaultValue buffer.byteLength
       */
      length?: number
      /**
       * @en Specifies the position from which to start reading from the file. If `position` is `null`, the data will be read from the current file position and the file position will be updated
       * @zh 指定从文件中开始读取的位置，如果 `position` 为 `null`，则将从当前文件位置读取数据，并更新文件位置
       * @defaultValue null
       */
      position?: number | null
    }

    /**
     * @en The number of bytes read
     * @zh 读取的字节数
     */
    type Result = number
  }

  /**
   * @en Synchronously reads the content from the file specified by the file handle into the given `ArrayBuffer`.
   * @zh 同步地从文件句柄指定的文件中读取内容，将内容读取到给定 `ArrayBuffer` 中
   * @example
   * ```js
   * import { openSync, readSync, O_RDONLY } from '@zos/fs'
   *
   * const fd = openSync({
   *   path: 'test.txt',
   *   flag: O_RDONLY
   * })
   *
   * const buffer = new ArrayBuffer(4)
   * const result = readSync({
   *   fd,
   *   buffer
   * })
   * ```
   */
  function readSync(option: readSync.Option): readSync.Result
  namespace writeSync {
    interface Option {
      /**
       * @en File handle, returned by the `openSync`, `openAssetsSync` and other APIs
       * @zh 文件句柄，由 `openSync`、`openAssetsSync` 等 API 返回
       */
      fd: number
      /**
       * @en The buffer that the data will be written to
       * @zh 将写入文件的 ArrayBuffer
       */
      buffer: ArrayBuffer
      /**
       * @en Other Options
       * @zh 其他选项
       */
      options?: Options
    }

    interface Options {
      /**
       * @en Based on first address offset in ArrayBuffer to write the data
       * @zh 基于要写入文件的 ArrayBuffer 首地址偏移量
       * @defaultValue 0
       */
      offset?: number
      /**
       * @en The number of bytes to write, the default is the length of the incoming buffer
       * @zh 写入的字节数，默认为传入 buffer 的字节长度
       * @defaultValue buffer.byteLength
       */
      length?: number
      /**
       * @en Position refers to the offset from the beginning of the file where this data should be written. If position is 'null', the data will be written at the and the file position will be updated
       * @zh 指定文件中开始写入的位置，表示从文件开头的偏移量。如果 `position` 为 `null`，则从当前文件位置写入数据，并更新文件位置
       * @defaultValue null
       */
      position?: number | null
    }

    /**
     * @en The number of bytes written
     * @zh 写入的字节数
     */
    type Result = number
  }

  /**
   * @en Synchronously write ArrayBuffer to the file specified by fd
   * @zh 同步地将 ArrayBuffer 写入文件句柄指定的文件
   * @example
   * ```js
   * import { openSync, writeSync, O_RDWR, O_CREAT } from '@zos/fs'
   *
   * const fd = openSync({
   *   path: 'test.txt',
   *   flag: O_RDWR | O_CREAT
   * })
   *
   * const buffer = new ArrayBuffer(4)
   * const result = writeSync({
   *   fd,
   *   buffer
   * })
   * ```
   */
  function writeSync(option: writeSync.Option): writeSync.Result
  namespace rmSync {
    interface Option {
      /**
       * @en path
       * @zh 文件路径
       */
      path: string
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Synchronously delete files in the `/data` directory of the Mini Program
   * @zh 同步地删除小程序 `/data` 目录下的文件
   * @example
   * ```js
   * import { rmSync } from '@zos/fs'
   *
   * const result = rmSync({
   *   path: 'test.txt',
   * })
   *
   * if (result === 0) {
   *   console.log('rmSync success')
   * }
   * ```
   */
  function rmSync(option: rmSync.Option): rmSync.Result
  function rmSync(path: string): rmSync.Result
  namespace renameSync {
    interface Option {
      /**
       * @en Old path
       * @zh 旧的文件路径
       */
      oldPath: string
      /**
       * @en New path
       * @zh 新的文件路径
       */
      newPath: string
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Rename the files in the `/data` directory of the Mini Program, renaming the files from `oldPath` to `newPath`
   * @zh 重命名小程序 `/data` 目录下的文件，将文件从 `oldPath` 重命名为 `newPath`
   * @example
   * ```js
   * import { renameSync } from '@zos/fs'
   *
   * const result = renameSync({
   *   oldPath: 'test.txt',
   *   newPath: 'new_test.txt'
   * })
   *
   * if (result === 0) {
   *   console.log('renameSync success')
   * }
   * ```
   */
  function renameSync(option: renameSync.Option): renameSync.Result
  namespace mkdirSync {
    interface Option {
      /**
       * @en Directory path
       * @zh 目录路径
       */
      path: string
    }

    /**
     * @en If `0` is returned, success is indicated
     * @zh 如果返回 `0` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Synchronously create a directory in the `/data` directory of the Mini Program
   * @zh 同步地在小程序 `/data` 目录下创建目录
   * @example
   * ```js
   * import { mkdirSync } from '@zos/fs'
   *
   * const result = mkdirSync({
   *   path: 'content',
   * })
   *
   * if (result === 0) {
   *   console.log('mkdirSync success')
   * }
   * ```
   */
  function mkdirSync(option: mkdirSync.Option): mkdirSync.Result
  function mkdirSync(path: string): mkdirSync.Result
  namespace readdirSync {
    interface Option {
      /**
       * @en Directory path
       * @zh 目录路径
       */
      path: string
    }

    /**
     * @en If `undefined` is returned, the directory does not exist, otherwise an array of filenames is returned
     * @zh 如果返回 `undefined` 则目录不存在，否则返回文件名数组
     */
    type Result = Array<string> | undefined
  }

  /**
   * @en Read the directory under the `/data` directory of the Mini Program synchronously
   * @zh 同步地读取小程序 `/data` 目录下的目录
   * @example
   * ```js
   * import { readdirSync } from '@zos/fs'
   *
   * const result = readdirSync({
   *   path: 'content',
   * })
   * ```
   */
  function readdirSync(option: readdirSync.Option): readdirSync.Result
  namespace readFileSync {
    interface Option {
      /**
       * @en path
       * @zh 文件路径
       */
      path: string
      /**
       * @en Other Options
       * @zh 其他选项
       */
      options?: Options
    }

    interface Options {
      /**
       * @en When the encoding method is specified, the API returns `string` as the result
       * @zh 当指定了编码方式之后，API 返回结果为 `string`
       */
      encoding?: string
    }

    /**
     * @en File content. If `undefined` is returned, the file failed to be read
     * @zh 文件内容。如果返回 `undefined`，则表明读取文件失败
     */
    type Result = ArrayBuffer | string | undefined
  }

  /**
   * @en Returns the entire contents of the specified file in the `/data` directory of the Mini Program
   * @zh 返回小程序 `/data` 目录下指定文件的全部内容
   * @example
   * ```js
   * import { readFileSync } from '@zos/fs'
   *
   * const contentBuffer = readFileSync({
   *   path: 'test.txt',
   * })
   *
   * const contentString = readFileSync({
   *   path: 'test.txt',
   *   options: {
   *     encoding: 'utf8'
   *   }
   * })
   * ```
   */
  function readFileSync(option: readFileSync.Option): readFileSync.Result
  namespace writeFileSync {
    interface Option {
      /**
       * @en File path or file descriptor
       * @zh 文件路径或者文件句柄
       */
      path: string | number
      /**
       * @en Data to be written to the target file
       * @zh 写入目标文件的数据
       */
      data: ArrayBuffer | string | DataView
      /**
       * @en Other Options
       * @zh 其他选项
       */
      options?: Options
    }

    interface Options {
      /**
       * @en If the `data` format is `string`, you need to specify the encoding method
       * @zh 如果数据格式为 `string`，需要指定编码方式
       * @defaultValue utf8
       */
      encoding?: string
    }
  }

  /**
   * @en Synchronously write data to a file in the `/data` directory of the Mini Program, replacing the file if it already exists, or creating a new file if it doesn't
   * @zh 同步地将数据写入小程序 `/data` 目录下的文件，如果文件已存在则替换文件，不存在则新建文件
   * @example
   * ```js
   * import { writeFileSync } from '@zos/fs'
   *
   * const buffer = new ArrayBuffer(4)
   * writeFileSync({
   *   path: 'test.txt',
   *   data: buffer
   * })
   *
   * writeFileSync({
   *   path: 'content.txt',
   *   data: 'some content...',
   *   options: {
   *     encoding: 'utf8'
   *   }
   * })
   * ```
   */
  function writeFileSync(option: writeFileSync.Option): void
}
declare namespace App {
    interface Option {
        /**
         * @en Mounted data objects on App instances that can be used to store the global state of the Mini Program
         * @zh App 实例上的挂载的数据对象，可用于存储小程序全局状态
         */
        globalData?: object;
        /**
         * @en Mounted data objects on App instances that can be used to store the global state of the Mini Program
         * @zh App onCreate 生命周期函数，如果是通过 router 模块中相关方法打开小程序，并且携带 params 参数，则在 onCreate 方法中可以获取到 params 字符串
         */
        onCreate?: (params?: string) => void;
        /**
         * @en The `onDestroy` lifecycle function is triggered when the Mini Program is destroyed
         * @zh 小程序销毁时触发 `onDestroy` 生命周期函数
         */
        onDestroy?: () => void;
    }

    /**
     * @en App instance
     * @zh App 实例
     */
    type Result = unknown;
}

/**
 * @en Register the Mini Program, specifying the Mini Program's lifecycle callbacks, etc. `App()` must be called in `app.js`, and can only be called once
 * @zh 注册小程序，指定小程序的生命周期回调等。`App()` 必须在 `app.js` 中调用，且只能调用一次
 * @example
 * ```js title="app.js"
 * App({
 *   globalData: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onCreate() {
 *     console.log('onCreate')
 *     console.log(this.globalData.text)
 *   },
 *   onDestroy() {
 *     console.log('onDestroy')
 *   }
 * })
 * ```
 */
declare function App(option: App.Option): App.Result;

declare namespace getApp {
    /**
     * @en App instance
     * @zh App 实例
     * @output
     */
    interface Result {
        /**
         * @en app instance property
         * @zh app 实例属性
         */
        _options: Options;
    }

    /**
     * @en app instance property
     * @zh app 实例属性
     * @output
     */
    interface Options {
        /**
         * @en Other properties passed in on the App constructor
         * @zh App 构造函数上传入的其他属性
         */
        [propName: string]: any;
        /**
         * @en mounted data objects on app instances
         * @zh app 实例上的挂载的数据对象
         */
        globalData?: object;
    }
}

/**
 * @en Get the app instance object
 * @zh 获取 app 实例对象
 * @example
 * ```js
 * App({
 *   globalData: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onCreate() {
 *     console.log('onCreate')
 *     console.log(this.globalData.text)
 *   },
 *   onDestroy() {
 *     console.log('onDestroy')
 *   }
 * })
 *
 * const app = getApp()
 * console.log(app._options.globalData.text)
 * ```
 */
declare function getApp(): getApp.Result;

declare namespace Page {
    interface Option {
        /**
         * @en A data object mounted on a page instance that can be used to store the state of the current page
         * @zh page 实例上挂载的数据对象，可用于存储当前页面的状态
         */
        state?: object;
        /**
         * @en It is triggered once per page and can be used to initialize the page state. If the page is opened by the relevant method in the router module with params parameters, the params string can be retrieved in the onInit method
         * @zh 页面初始化完成时触发，每个页面只触发一次，可以用来初始化 page 状态。如果是通过 router 模块中相关方法打开页面，并且携带 params 参数，则在 onInit 方法中可以获取到 params 字符串
         */
        onInit?: (params?: string) => void;
        /**
         * @en Triggered after `onInit` execution completes, recommended for UI drawing in the `build` lifecycle
         * @zh 在 `onInit` 执行完成后触发，推荐在 `build` 生命周期中进行 UI 绘制
         */
        build?: (params?: string) => void;
        /**
         * @en The `onDestroy` lifecycle function is triggered when the page is destroyed
         * @zh 页面销毁时触发 `onDestroy` 生命周期函数
         */
        onDestroy?: () => void;
    }

    /**
     * @en Page instance
     * @zh Page 实例
     */
    type Result = unknown;
}

/**
 * @en Register a page in the Mini Program, specify the lifecycle callback for the current page, etc. Each page file must call the `Page()` constructor only once
 * @zh 注册小程序中的一个页面，指定当前页面的生命周期回调等。每个页面文件都必须调用 `Page()` 构造函数且只能调用一次
 * @example
 * ```js title="page.js"
 * Page({
 *   state: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onInit() {
 *     console.log('onInit')
 *   },
 *   build() {
 *     console.log('build')
 *     console.log(this.state.text)
 *   }
 * })
 * ```
 */
declare function Page(option: Page.Option): Page.Result;

declare namespace SecondaryWidget {
    interface Option {
        /**
         * @en A data object mounted on a SecondaryWidget instance that can be used to store the state of the current SecondaryWidget
         * @zh SecondaryWidget 副屏应用实例上挂载的数据对象，可用于存储状态
         */
        state?: object;
        /**
         * @en It is triggered once per SecondaryWidget and can be used to initialize the SecondaryWidget state
         * @zh 初始化完成时触发，只触发一次，可以用来初始化 SecondaryWidget 状态
         */
        onInit?: (params?: string) => void;
        /**
         * @en Triggered after `onInit` execution completes, recommended for UI drawing in the `build` lifecycle
         * @zh 在 `onInit` 执行完成后触发，推荐在 `build` 生命周期中进行 UI 绘制
         */
        build?: (params?: string) => void;
        /**
         * @en Triggered when the screen focus is on this SecondaryWidget
         * @zh 当屏幕焦点聚焦在此副屏应用上时触发
         */
        onResume?: () => void;
        /**
         * @en Triggered when the screen focus leaves this SecondaryWidget
         * @zh 当屏幕焦点离开此副屏应用上时触发
         */
        onPause?: () => void;
        /**
         * @en The `onDestroy` lifecycle function is triggered when the SecondaryWidget is destroyed
         * @zh 销毁时触发 `onDestroy` 生命周期函数
         */
        onDestroy?: () => void;
    }

    /**
     * @en SecondaryWidget instance
     * @zh SecondaryWidget 实例
     */
    type Result = unknown;
}

/**
 * @en Register SecondaryWidget, specify the lifecycle callback for the current SecondaryWidget, etc. Each SecondaryWidget file must call the `SecondaryWidget()` constructor only once
 * @zh 注册副屏应用，指定当前页面的生命周期回调等。每个副屏应用都必须调用 `SecondaryWidget()` 构造函数且只能调用一次
 * @example
 * ```js title="secondaryWidget.js"
 * SecondaryWidget({
 *   state: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onInit() {
 *     console.log('onInit')
 *   },
 *   build() {
 *     console.log('build')
 *     console.log(this.state.text)
 *   }
 * })
 * ```
 */
declare function SecondaryWidget(option: SecondaryWidget.Option): SecondaryWidget.Result;

declare namespace AppWidget {
    interface Option {
        /**
         * @en A data object mounted on a AppWidget instance that can be used to store the state of the current AppWidget
         * @zh AppWidget 快捷卡片实例上挂载的数据对象，可用于存储状态
         */
        state?: object;
        /**
         * @en It is triggered once per AppWidget and can be used to initialize the AppWidget state
         * @zh 初始化完成时触发，只触发一次，可以用来初始化 AppWidget 状态
         */
        onInit?: (params?: string) => void;
        /**
         * @en Triggered after `onInit` execution completes, recommended for UI drawing in the `build` lifecycle
         * @zh 在 `onInit` 执行完成后触发，推荐在 `build` 生命周期中进行 UI 绘制
         */
        build?: (params?: string) => void;
        /**
         * @en Triggered when the screen focus is on this AppWidget
         * @zh 当屏幕焦点聚焦在此快捷卡片上时触发
         */
        onResume?: () => void;
        /**
         * @en Triggered when the screen focus leaves this AppWidget
         * @zh 当屏幕焦点离开此快捷卡片上时触发
         */
        onPause?: () => void;
        /**
         * @en The `onDestroy` lifecycle function is triggered when the AppWidget is destroyed
         * @zh 销毁时触发 `onDestroy` 生命周期函数
         */
        onDestroy?: () => void;
    }

    /**
     * @en AppWidget instance
     * @zh AppWidget 实例
     */
    type Result = unknown;
}

/**
 * @en Register AppWidget, specify the lifecycle callback for the current AppWidget, etc. Each AppWidget file must call the `AppWidget()` constructor only once
 * @zh 注册快捷卡片，指定当前页面的生命周期回调等。每个快捷卡片都必须调用 `AppWidget()` 构造函数且只能调用一次
 * @example
 * ```js title="appWidget.js"
 * AppWidget({
 *   state: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onInit() {
 *     console.log('onInit')
 *   },
 *   build() {
 *     console.log('build')
 *     console.log(this.state.text)
 *   }
 * })
 * ```
 */
declare function AppWidget(option: AppWidget.Option): AppWidget.Result;

declare namespace DataWidget {
    interface Option {
        /**
         * @en A data object mounted on a DataWidget instance that can be used to store the state of the current DataWidget
         * @zh DataWidget 实例上挂载的数据对象，可用于存储状态
         */
        state?: object;
        /**
         * @en It is triggered once per DataWidget and can be used to initialize the DataWidget state
         * @zh 初始化完成时触发，只触发一次，可以用来初始化应用插件状态
         */
        onInit?: (params?: string) => void;
        /**
         * @en Triggered after `onInit` execution completes, recommended for UI drawing in the `build` lifecycle
         * @zh 在 `onInit` 执行完成后触发，推荐在 `build` 生命周期中进行 UI 绘制
         */
        build?: (params?: string) => void;
        /**
         * @en Triggered when the screen focus is on this DataWidget
         * @zh 当屏幕焦点聚焦在此应用插件上时触发
         */
        onResume?: () => void;
        /**
         * @en Triggered when the screen focus leaves this DataWidget
         * @zh 当屏幕焦点离开此应用插件上时触发
         */
        onPause?: () => void;
        /**
         * @en The `onDestroy` lifecycle function is triggered when the DataWidget is destroyed
         * @zh 销毁时触发 `onDestroy` 生命周期函数
         */
        onDestroy?: () => void;
    }

    /**
     * @en DataWidget instance
     * @zh DataWidget 实例
     */
    type Result = object;
}

/**
 * @en Register DataWidget, specify the lifecycle callback for the current DataWidget, etc. Each DataWidget file must call the `DataWidget()` constructor only once
 * @zh 注册应用插件，指定当前页面的生命周期回调等。每个应用插件都必须调用 `DataWidget()` 构造函数且只能调用一次
 * @version 3.6
 * @example
 * ```js title="DataWidget.js"
 * DataWidget({
 *   state: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onInit() {
 *     console.log('onInit')
 *   },
 *   build() {
 *     console.log('build')
 *     console.log(this.state.text)
 *   }
 * })
 * ```
 */
declare function DataWidget(option: DataWidget.Option): DataWidget.Result;

declare namespace AppService {
    interface Option {
        /**
         * @en A data object mounted on the appService instance that can be used to store the current state of the service
         * @zh appService 实例上挂载的数据对象，可用于存储当前服务的状态
         */
        state?: object;
        /**
         * @en This function is triggered when the service is started. If the service is started with params, the params string can be obtained in the onInit method
         * @zh 启动服务的时候触发该函数，如果启动服务携带 params 参数，则在 onInit 方法中可以获取到 params 字符串
         */
        onInit?: (params?: string) => void;
        /**
         * @en The `onDestroy` lifecycle function is triggered when the service is destroyed
         * @zh 服务销毁时触发 `onDestroy` 生命周期函数
         */
        onDestroy?: () => void;
    }

    /**
     * @en AppService instance
     * @zh AppService 实例
     */
    type Result = unknown;
}

/**
 * @en Register an App Service in the Mini Program, specify the lifecycle callback for the current App Service, etc. Each App Service file must call the `AppService()` constructor only once
 * @zh 注册设备应用服务，指定当前服务的生命周期回调等。每个设备应用服务都必须调用 `AppService()` 构造函数且只能调用一次
 * @permissionCode device:os.bg_service
 * @version 3.0
 * @example
 * ```js title="appService.js"
 * AppService({
 *   state: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onInit() {
 *     console.log('onInit')
 *   }
 * })
 * ```
 */
declare function AppService(option: AppService.Option): AppService.Result;

declare namespace getCurrentPage {
    /**
     * @en page instance
     * @zh page 实例
     * @output
     */
    interface Result {
        /**
         * @en page instance property
         * @zh page 实例属性
         */
        _options: Options;
    }

    interface Options {
        /**
         * @en Other properties passed in on the Page constructor
         * @zh Page 构造函数上传入的其他属性
         */
        [propName: string]: any;
        /**
         * @en mounted data objects on page instances
         * @zh page 实例上的挂载的数据对象
         */
        state?: object;
    }
}

/**
 * @en Get the page instance object
 * @zh 获取 page 实例对象
 * @example
 * ```js title="page.js"
 * Page({
 *   state: {
 *     text: 'Hello Zepp OS'
 *   },
 *   onInit() {
 *     console.log('onInit')
 *   },
 *   build() {
 *     console.log('build')
 *     console.log(this.state.text)
 *   }
 * })
 *
 * const page = getCurrentPage()
 * console.log(page._options.state.text)
 * ```
 */
declare function getCurrentPage(): getCurrentPage.Result;

/**
 * @en Console Print Log
 * @zh 控制台打印日志
 * @example
 * ```js
 * console.log('Hello Zepp OS')
 * ```
 */
declare interface console {
    /**
     * @en Print log level logs with any number of parameters. Each log is limited in length and will be truncated if it is exceeded. To print the full content, the developer needs to print the content in multiple times
     * @zh 打印 log 等级的日志，可传入任意多个参数。每条日志打印长度有限，超出部分会被截断，如需打印完整内容，需要开发者将内容分多次打印
     */
    log(...data: any[]): void;
}

declare namespace setTimeout {
    /**
     * @en Callback functions executed after the timer expires
     * @zh 定时器到期后执行的回调函数
     */
    type Callback = () => unknown;
    /**
     * @en The number of milliseconds to delay the function, default 1ms
     * @zh 函数延迟的毫秒数，默认 1ms
     */
    type Delay = number;
    /**
     * @en Timer number
     * @zh 定时器的编号
     */
    type TimeoutID = number;
}

/**
 * @en Set a timer and execute the registered callback function after the timer expires
 * @zh 设置一个定时器，在定时器到期之后执行注册的回调函数
 * @example
 * ```js
 * setTimeout(() => {
 *   console.log('Hello Zepp OS')
 * }, 1000)
 * ```
 */
declare function setTimeout(callback: setTimeout.Callback, delay?: setTimeout.Delay): setTimeout.TimeoutID;

declare namespace clearTimeout {
    /**
     * @en Timer number
     * @zh 定时器的编号
     */
    type TimeoutID = number;
}

/**
 * @en Cancel the timer registered by `setTimeout`
 * @zh 取消 `setTimeout` 注册的定时器
 * @example
 * ```js
 * const timeoutID = setTimeout(() => {
 *   console.log('Hello Zepp OS')
 * }, 1000)
 *
 * clearTimeout(timeoutID)
 * ```
 */
declare function clearTimeout(timeoutID: clearTimeout.TimeoutID): void;

declare namespace setInterval {
    /**
     * @en Repeatedly called callback functions
     * @zh 重复调用的回调函数
     */
    type Callback = () => unknown;
    /**
     * @en Time interval between each callback function call
     * @zh 每次调用回调函数的时间间隔
     */
    type Delay = number;
    /**
     * @en Timer number
     * @zh 定时器的编号
     */
    type IntervalID = number;
}

/**
 * @en Repeatedly call a function with a fixed time interval between each call
 * @zh 重复调用一个函数，在每次调用之间具有固定的时间间隔
 * @example
 * ```js
 * setInterval(() => {
 *   console.log('Hello Zepp OS')
 * }, 1000)
 * ```
 */
declare function setInterval(callback: setInterval.Callback, delay: setInterval.Delay): setInterval.IntervalID;

declare namespace clearInterval {
    /**
     * @en Timer number
     * @zh 定时器的编号
     */
    type IntervalID = number;
}

/**
 * @en Cancel the timer registered by `setInterval`
 * @zh 取消 `setInterval` 注册的定时器
 * @example
 * ```js
 * const intervalID = setInterval(() => {
 *   console.log('Hello Zepp OS')
 * }, 1000)
 *
 * clearInterval(intervalID)
 * ```
 */
declare function clearInterval(intervalID: clearInterval.IntervalID): void;
declare class Buffer extends Uint8Array {
  length: number
  write(string: string, offset?: number, length?: number, encoding?: string): number
  toString(encoding?: string, start?: number, end?: number): string
  toJSON(): { type: 'Buffer'; data: any[] }
  equals(otherBuffer: Buffer): boolean
  compare(
    otherBuffer: Uint8Array,
    targetStart?: number,
    targetEnd?: number,
    sourceStart?: number,
    sourceEnd?: number,
  ): number
  copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number
  slice(start?: number, end?: number): Buffer
  writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number
  writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number
  writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number
  writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number
  readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number
  readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number
  readIntLE(offset: number, byteLength: number, noAssert?: boolean): number
  readIntBE(offset: number, byteLength: number, noAssert?: boolean): number
  readUInt8(offset: number, noAssert?: boolean): number
  readUInt16LE(offset: number, noAssert?: boolean): number
  readUInt16BE(offset: number, noAssert?: boolean): number
  readUInt32LE(offset: number, noAssert?: boolean): number
  readUInt32BE(offset: number, noAssert?: boolean): number
  readBigUInt64LE(offset: number): BigInt
  readBigUInt64BE(offset: number): BigInt
  readInt8(offset: number, noAssert?: boolean): number
  readInt16LE(offset: number, noAssert?: boolean): number
  readInt16BE(offset: number, noAssert?: boolean): number
  readInt32LE(offset: number, noAssert?: boolean): number
  readInt32BE(offset: number, noAssert?: boolean): number
  readBigInt64LE(offset: number): BigInt
  readBigInt64BE(offset: number): BigInt
  readFloatLE(offset: number, noAssert?: boolean): number
  readFloatBE(offset: number, noAssert?: boolean): number
  readDoubleLE(offset: number, noAssert?: boolean): number
  readDoubleBE(offset: number, noAssert?: boolean): number
  reverse(): this
  swap16(): Buffer
  swap32(): Buffer
  swap64(): Buffer
  writeUInt8(value: number, offset: number, noAssert?: boolean): number
  writeUInt16LE(value: number, offset: number, noAssert?: boolean): number
  writeUInt16BE(value: number, offset: number, noAssert?: boolean): number
  writeUInt32LE(value: number, offset: number, noAssert?: boolean): number
  writeUInt32BE(value: number, offset: number, noAssert?: boolean): number
  writeBigUInt64LE(value: number, offset: number): BigInt
  writeBigUInt64BE(value: number, offset: number): BigInt
  writeInt8(value: number, offset: number, noAssert?: boolean): number
  writeInt16LE(value: number, offset: number, noAssert?: boolean): number
  writeInt16BE(value: number, offset: number, noAssert?: boolean): number
  writeInt32LE(value: number, offset: number, noAssert?: boolean): number
  writeInt32BE(value: number, offset: number, noAssert?: boolean): number
  writeBigInt64LE(value: number, offset: number): BigInt
  writeBigInt64BE(value: number, offset: number): BigInt
  writeFloatLE(value: number, offset: number, noAssert?: boolean): number
  writeFloatBE(value: number, offset: number, noAssert?: boolean): number
  writeDoubleLE(value: number, offset: number, noAssert?: boolean): number
  writeDoubleBE(value: number, offset: number, noAssert?: boolean): number
  fill(value: any, offset?: number, end?: number): this
  indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number
  lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number
  includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean

  /**
   * Allocates a new buffer containing the given {str}.
   *
   * @param str String to store in buffer.
   * @param encoding encoding to use, optional.  Default is 'utf8'
   */
  constructor(str: string, encoding?: string)
  /**
   * Allocates a new buffer of {size} octets.
   *
   * @param size count of octets to allocate.
   */
  constructor(size: number)
  /**
   * Allocates a new buffer containing the given {array} of octets.
   *
   * @param array The octets to store.
   */
  constructor(array: Uint8Array)
  /**
   * Produces a Buffer backed by the same allocated memory as
   * the given {ArrayBuffer}.
   *
   *
   * @param arrayBuffer The ArrayBuffer with which to share memory.
   */
  constructor(arrayBuffer: ArrayBuffer)
  /**
   * Allocates a new buffer containing the given {array} of octets.
   *
   * @param array The octets to store.
   */
  constructor(array: any[])
  /**
   * Copies the passed {buffer} data onto a new {Buffer} instance.
   *
   * @param buffer The buffer to copy.
   */
  constructor(buffer: Buffer)
  prototype: Buffer
  /**
   * Allocates a new Buffer using an {array} of octets.
   *
   * @param array
   */
  static from(array: any[]): Buffer
  /**
   * When passed a reference to the .buffer property of a TypedArray instance,
   * the newly created Buffer will share the same allocated memory as the TypedArray.
   * The optional {byteOffset} and {length} arguments specify a memory range
   * within the {arrayBuffer} that will be shared by the Buffer.
   *
   * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
   * @param byteOffset
   * @param length
   */
  static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer
  /**
   * Copies the passed {buffer} data onto a new Buffer instance.
   *
   * @param buffer
   */
  static from(buffer: Buffer | Uint8Array): Buffer
  /**
   * Creates a new Buffer containing the given JavaScript string {str}.
   * If provided, the {encoding} parameter identifies the character encoding.
   * If not provided, {encoding} defaults to 'utf8'.
   *
   * @param str
   */
  static from(str: string, encoding?: string): Buffer
  /**
   * Returns true if {obj} is a Buffer
   *
   * @param obj object to test.
   */
  static isBuffer(obj: any): obj is Buffer
  /**
   * Returns true if {encoding} is a valid encoding argument.
   * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
   *
   * @param encoding string to test.
   */
  static isEncoding(encoding: string): boolean
  /**
   * Gives the actual byte length of a string. encoding defaults to 'utf8'.
   * This is not the same as String.prototype.length since that returns the number of characters in a string.
   *
   * @param string string to test.
   * @param encoding encoding used to evaluate (defaults to 'utf8')
   */
  static byteLength(string: string, encoding?: string): number
  /**
   * Returns a buffer which is the result of concatenating all the buffers in the list together.
   *
   * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
   * If the list has exactly one item, then the first item of the list is returned.
   * If the list has more than one item, then a new Buffer is created.
   *
   * @param list An array of Buffer objects to concatenate
   * @param totalLength Total length of the buffers when concatenated.
   *   If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
   */
  static concat(list: Uint8Array[], totalLength?: number): Buffer
  /**
   * The same as buf1.compare(buf2).
   */
  static compare(buf1: Uint8Array, buf2: Uint8Array): number
  /**
   * Allocates a new buffer of {size} octets.
   *
   * @param size count of octets to allocate.
   * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
   *    If parameter is omitted, buffer will be filled with zeros.
   * @param encoding encoding used for call to buf.fill while initializing
   */
  static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer
  /**
   * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
   * of the newly created Buffer are unknown and may contain sensitive data.
   *
   * @param size count of octets to allocate
   */
  static allocUnsafe(size: number): Buffer
  /**
   * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
   * of the newly created Buffer are unknown and may contain sensitive data.
   *
   * @param size count of octets to allocate
   */
  static allocUnsafeSlow(size: number): Buffer
}


/**
  * @en I18n
  * @zh 国际化
  */
declare module '@zos/i18n' {

  namespace getText {
    /**
     * @en Internationalization key
     * @zh 国际化 key
     */
    type Key = string

    /**
     * @en The string corresponding to the internationalized key
     * @zh 国际化 key 对应的字符串
     */
    type Result = string
  }

  /**
   * @en Get the corresponding string from the internationalization resource file (.po) based on the internationalization key
   * @zh 根据国际化 key 从国际化资源文件（.po）中获取对应的字符串
   * @example
   * ```js
   * import { getText } from '@zos/i18n'
   *
   * getText('name')
   * ```
   */
  function getText(key: getText.Key): getText.Result
}

/**
  * @en Interaction
  * @zh 交互
  */
declare module '@zos/interaction' {

  /**
   * @en Gesture up slide
   * @zh 手势上滑
   */
  const GESTURE_UP: number
  /**
   * @en Gesture down slide
   * @zh 手势下滑
   */
  const GESTURE_DOWN: number
  /**
   * @en Gesture left slide
   * @zh 手势左滑
   */
  const GESTURE_LEFT: number
  /**
   * @en Gesture right slide
   * @zh 手势右滑
   */
  const GESTURE_RIGHT: number
  /**
   * @en BACK KEY
   * @zh BACK 按键
   */
  const KEY_BACK: number
  /**
   * @en SELECT KEY
   * @zh SELECT 按键
   */
  const KEY_SELECT: number
  /**
   * @en HOME KEY
   * @zh HOME 按键
   */
  const KEY_HOME: number
  /**
   * @en UP KEY
   * @zh UP 按键
   */
  const KEY_UP: number
  /**
   * @en SHORTCUT KEY
   * @zh DOWN 按键
   */
  const KEY_DOWN: number
  /**
   * @en SHORTCUT KEY
   * @zh SHORTCUT 按键
   */
  const KEY_SHORTCUT: number
  /**
   * @en Key click event
   * @zh 按键点击事件
   */
  const KEY_EVENT_CLICK: number
  /**
   * @en Key long-press event
   * @zh 按键长按事件
   */
  const KEY_EVENT_LONG_PRESS: number
  /**
   * @en Key double-click event
   * @zh 按键双击事件
   */
  const KEY_EVENT_DOUBLE_CLICK: number
  /**
   * @en Key press event
   * @zh 按键按下事件，只要是按下按键就会触发，如一次 CLICK 事件一共会触发三次事件 PRESS -> RELEASE -> CLICK
   */
  const KEY_EVENT_PRESS: number
  /**
   * @en Key release event
   * @zh 按键释放事件
   */
  const KEY_EVENT_RELEASE: number
  /**
   * @en Modal Confirm button
   * @zh Modal 确认按键
   */
  const MODAL_CONFIRM: number
  /**
   * @en Modal Cancel button
   * @zh Modal 取消按键
   */
  const MODAL_CANCEL: number
  /**
   * @en Wrist lift
   * @zh 抬腕动作
   */
  const WRIST_MOTION_LIFT: number
  /**
   * @en Wrist down
   * @zh 落腕动作
   */
  const WRIST_MOTION_LOWER: number
  /**
   * @en Flip wrist movement
   * @zh 翻转手腕动作
   */
  const WRIST_MOTION_FLIP: number
  namespace showToast {
    interface Option {
      /**
       * @en Content of the prompt
       * @zh 提示的内容
       */
      content: string
    }
  }

  /**
   * @en Display Message Prompt Box
   * @zh 显示消息提示框
   * @img https://img-cdn.huami.com/20220927/d53c5278ad075cdabc9bcf4e359d3d5c.jpg
   * @example
   * ```js
   * import { showToast } from '@zos/interaction'
   *
   * showToast({
   *   content: 'hello world'
   * })
   * ```
   */
  function showToast(option: showToast.Option): void
  namespace createModal {
    interface Option {
      /**
       * @en title of Modal
       * @zh Modal 对话框的标题
       */
      content: string
      /**
       * @en Modal dialog box title, alias for `content`
       * @zh Modal 对话框的标题，`content` 的别名
       * @version 3.6
       */
      title?: string
      /**
       * @en Whether to display Modal immediately after the creation is completed
       * @zh 完成创建后是否立即显示 Modal 对话框
       * @defaultValue true
       */
      show?: boolean
      /**
       * @en Whether to display Modal immediately
       * @zh 点击确认或者取消的回调函数
       */
      onClick?: (keyObj: KeyObj) => void
      /**
       * @en Whether to automatically close the Modal dialog after clicking the Confirm or Cancel button
       * @zh 点击确认或者取消按钮后，是否自动关闭 Modal 对话框
       * @defaultValue true
       */
      autoHide?: boolean
      /**
       * @en subtitle
       * @zh 子标题
       * @version 3.6
       */
      subtitle?: string
      /**
       * @en Icon icon path
       * @zh icon 图标路径
       * @version 3.6
       */
      src?: string
      /**
       * @en text content
       * @zh 文本内容
       * @version 3.6
       */
      text?: string
      /**
       * @en text color
       * @zh 文本颜色
       * @defaultValue 0xFFFFFF
       * @version 3.6
       */
      textColor?: number
      /**
       * @en Text transparency, transparency [0-255], 0 is full transparency
       * @zh 文本透明度，透明度[0-255]，0 为全透明
       * @defaultValue 255
       * @version 3.6
       */
      textAlpha?: number
      /**
       * @en The icon path of the confirmation button
       * @zh 确认按钮的 icon 图标路径
       * @version 3.6
       */
      okButton?: string
      /**
       * @en Cancel button icon icon path
       * @zh 取消按钮的 icon 图标路径
       * @version 3.6
       */
      cancelButton?: string
      /**
       * @en Capsule button configuration, as a string array, click `type` in the returned KeyObj starting from `10`
       * @zh 胶囊按钮配置，为字符串数组，点击返回的 KeyObj 中的 `type` 从 `10` 开始
       * @version 3.6
       */
      capsuleButton?: Array<string>
    }

    /**
     * @output
     */
    interface KeyObj {
      /**
       * @en Modal key name, value reference Modal key name constants
       * @zh Modal 按键名，值参考 Modal 按键名常量
       */
      type: number
    }

    /**
     * @output
     */
    interface Modal {
      /**
       * @en Show or hide Modal
       * @zh 显示或隐藏 Modal 对话框
       */
      show: (isShow: boolean) => void
    }
  }

  /**
   * @en Create Modal prompt box
   * @zh 创建 Modal 确认提示框
   * @constants modalKey
   * @img https://img-cdn.huami.com/20220927/9a9ce61a400f089c984951ca71c6f9b0.jpg
   * @example
   * ```js
   * import { createModal, MODAL_CONFIRM } from '@zos/interaction'
   *
   * const dialog = createModal({
   *   content: 'hello world',
   *   autoHide: false,
   *   onClick: (keyObj) => {
   *     const { type } = keyObj
   *     if (type === MODAL_CONFIRM) {
   *       console.log('confirm')
   *     } else {
   *       dialog.show(false)
   *     }
   *   }
   * })
   *
   * dialog.show(true)
   * ```
   */
  function createModal(option: createModal.Option): createModal.Modal
  namespace onGesture {
    interface Option {
      /**
       * @en Gesture event callback function
       * @zh 手势事件回调函数
       */
      callback: (event: GestureEvent) => PreventDefault
    }

    /**
     * @en Gesture event name, value reference gesture event constants
     * @zh 手势事件名，值参考手势事件常量
     */
    type GestureEvent = number

    /**
     * @en Whether to skip the default gesture behavior, `true` - skip, `false` - don't skip
     * @zh 是否跳过默认手势行为，`true` - 跳过，`false` - 不跳过
     */
    type PreventDefault = boolean
  }

  /**
   * @en Listen to user gesture events, only one event is allowed to be registered, if multiple registrations will cause the last registered event to fail
   * @zh 监听用户手势事件，只允许注册一个事件，如果多次注册会导致上一次注册的事件失效
   * @constants gestureEvent
   * @example
   * ```js
   * import { onGesture, GESTURE_UP } from '@zos/interaction'
   *
   * onGesture({
   *   callback: (event) => {
   *     if (event === GESTURE_UP) {
   *       console.log('up')
   *     }
   *     return true
   *   }
   * })
   * ```
   */
  function onGesture(option: onGesture.Option): void
  function onGesture(callback: (event: onGesture.GestureEvent) => onGesture.PreventDefault): void
  /**
   * @en Cancel the `onGesture` registration to listen for user gesture events
   * @zh 取消 `onGesture` 注册的监听用户手势事件
   * @example
   * ```js
   * import { onGesture, offGesture, GESTURE_UP } from '@zos/interaction'
   *
   * const gestureCallback = (event) => {
   *   if (event === GESTURE_UP) {
   *     console.log('up')
   *   }
   *
   *   return true
   * }
   *
   * onGesture({
   *   callback: gestureCallback
   * })
   *
   * offGesture()
   * ```
   */
  function offGesture(): void
  namespace onKey {
    interface Option {
      /**
       * @en Key event callback function
       * @zh 按键事件回调函数
       */
      callback: (key: Key, event: KeyEvent) => PreventDefault
    }

    /**
     * @en Key name, value reference key name constants
     * @zh 按键名，值参考按键名常量
     */
    type Key = number

    /**
     * @en Key event name, value reference key event constants
     * @zh 按键事件名，值参考按键事件常量
     */
    type KeyEvent = number

    /**
     * @en Whether to skip the default key behavior, `true` - skip, `false` - don't skip
     * @zh 是否跳过默认按键行为，`true` - 跳过，`false` - 不跳过
     */
    type PreventDefault = boolean
  }

  /**
   * @en Listen to key events, only one event is allowed to be registered, if multiple registrations will cause the last registered event to fail
   * @zh 监听按键事件，只允许注册一个事件，如果多次注册会导致上一次注册的事件失效
   * @constants key,keyEvent
   * @example
   * ```js
   * import { onKey, KEY_UP, KEY_EVENT_CLICK } from '@zos/interaction'
   *
   * onKey({
   *   callback: (key, keyEvent) => {
   *     if (key === KEY_UP && keyEvent === KEY_EVENT_CLICK) {
   *       console.log('up click')
   *     }
   *     return true
   *   }
   * })
   * ```
   */
  function onKey(option: onKey.Option): void
  function onKey(callback: (key: onKey.Key, event: onKey.KeyEvent) => onKey.PreventDefault): void
  /**
   * @en Cancel the keystroke event registered by `onKey`.
   * @zh 取消 `onKey` 注册的监听按键事件
   * @example
   * ```js
   * import { onKey, offKey, KEY_UP, KEY_EVENT_CLICK } from '@zos/interaction'
   *
   * const keyCallback = (key, keyEvent) => {
   *   if (key === KEY_UP && keyEvent === KEY_EVENT_CLICK) {
   *     console.log('up click')
   *   }
   *   return true
   * }
   *
   * onKey({
   *   callback: keyCallback
   * })
   *
   * offKey()
   * ```
   */
  function offKey(): void
  namespace onDigitalCrown {
    interface Option {
      /**
       * @en Digital crown rotation event callback function
       * @zh 数字表冠旋转事件回调函数
       */
      callback: (key: Key, degree: Degree) => void
    }

    /**
     * @en Key name, value reference key name constants, currently only `KEY_HOME` is supported
     * @zh 按键名，值参考按键名常量，目前仅支持 `KEY_HOME`
     */
    type Key = number

    /**
     * @en The rotation angle, positive number is counterclockwise rotation, negative number is clockwise rotation. The value is the angle of rotation, the faster the rotation speed, the larger the absolute value
     * @zh 旋转角度，正数为逆时针旋转，负数为顺时针旋转。数值为转过的角度，旋转速度越快，绝对值越大
     */
    type Degree = number
  }

  /**
   * @en Listen to the digital crown rotation event, only one event is allowed to be registered, if multiple registrations will cause the last registered event to fail
   * @zh 监听数字表冠旋转事件，只允许注册一个事件，如果多次注册会导致上一次注册的事件失效
   * @constants key
   * @example
   * ```js
   * import { onDigitalCrown, KEY_HOME } from '@zos/interaction'
   *
   * onDigitalCrown({
   *   callback: (key, degree) => {
   *     if (key === KEY_HOME) {
   *       console.log(degree)
   *     }
   *   }
   * })
   * ```
   */
  function onDigitalCrown(option: onDigitalCrown.Option): void
  function onDigitalCrown(
    callback: (key: onDigitalCrown.Key, degree: onDigitalCrown.Degree) => void,
  ): void
  /**
   * @en Cancel the `onDigitalCrown` registration to listen for digital crown rotation events
   * @zh 取消 `onDigitalCrown` 注册的监听数字表冠旋转事件
   * @example
   * ```js
   * import { onDigitalCrown, offDigitalCrown, KEY_HOME } from '@zos/interaction'
   *
   * const callback = (key, degree) => {
   *   if (key === KEY_HOME) {
   *     console.log(degree)
   *   }
   * }
   *
   * onDigitalCrown({
   *   callback
   * })
   *
   * offDigitalCrown()
   * ```
   */
  function offDigitalCrown(): void
  namespace onWristMotion {
    interface Option {
      /**
       * @en Digital crown rotation event callback function
       * @zh 手部动作事件回调函数
       */
      callback: (params: Params) => void
    }

    /**
     * @output
     */
    interface Params {
      /**
       * @en Action type, 0 - palm covering, 3 - wrist event
       * @zh 动作类型，0 - 覆掌，3 - 腕部事件
       * @version 3.6
       */
      type: number
      /**
       * @en Action code, value reference hand motion constant
       * @zh 动作代号，值参考手部动作常量
       */
      motion: number
    }
  }

  /**
   * @en Monitoring hand movement events
   * @zh 监听手部动作事件
   * @version 3.0
   * @constants motion
   * @example
   * ```js
   * import { onWristMotion, WRIST_MOTION_LIFT } from '@zos/interaction'
   *
   * onWristMotion({
   *   callback: (result) => {
   *     const { type, motion } = result
   *
   *     if (type === 3) {
   *       console.log(motion === WRIST_MOTION_LIFT)
   *     }
   *   }
   * })
   * ```
   */
  function onWristMotion(option: onWristMotion.Option): void
}

/**
  * @en Notification
  * @zh 系统通知
  */
declare module '@zos/notification' {

  namespace notify {
    interface Option {
      /**
       * @en Notice title text
       * @zh 通知标题文本
       */
      title: string
      /**
       * @en Text of the notice
       * @zh 通知内容文本
       */
      content: string
      /**
       * @en Custom button arrays
       * @zh 定制按钮数组
       */
      actions: Array<Action>
      /**
       * @defaultValue 0
       * @en Specify the vibration effect when the notification center pops up, 0 - default, 1 - beep, 2 - birdsong, 3 - drumbeat, 4 - gentle, 5 - buzz, Only effective for linear motors
       * @zh 指定通知中心弹出通知时的振动效果, 0 - 默认、1 - 蜂鸣、2 - 鸟鸣、3 - 鼓点、4 - 轻柔、5 - 加急，仅对线性马达生效
       */
      vibrate?: number
    }

    interface Action {
      /**
       * @en Button Text
       * @zh 按钮文本
       */
      text: string
      /**
       * @en The App Service file to be started
       * @zh 按钮点击要启动的「设备应用服务」文件
       */
      file: string
      /**
       * @en Parameters passed in during file loading
       * @zh 文件加载时传入的参数
       */
      param?: string
    }

    /**
     * @en The result of the notification delivery, returns `0` for delivery failure, the rest of the result indicates the ID of the notification
     * @zh 通知发送的结果，返回 `0` 代表发送失败，其余结果表明通知的 ID 标识
     */
    type Result = number
  }

  /**
   * @en Send notifications to the Watch Notification Center
   * @zh 发送通知到手表通知中心
   * @permissionCode device:os.notification
   * @version 3.0
   * @example
   * ```js
   * import { notify } from '@zos/notification'
   * ```
   */
  function notify(option: notify.Option): notify.Result
  /**
   * @en Delete the notification message identified by the specified ID in the notification center
   * @zh 删除通知中心里指定 ID 标识的通知信息
   * @permissionCode device:os.notification
   * @version 3.0
   * @example
   * ```js
   * import { cancel } from '@zos/notification'
   *
   * cancel(alarmID)
   * ```
   */
  function cancel(alarmId: number | Array<number>): void
  /**
   * @en Get the notification IDs that have been sent by the current app and are still in the notification center
   * @zh 获取当前应用已发送的还留在通知中心里通知 ID
   * @permissionCode device:os.notification
   * @version 3.0
   * @example
   * ```js
   * import { getAllNotifications } from '@zos/notification'
   *
   * getAllNotifications()
   * ```
   */
  function getAllNotifications(): Array<number>
}

/**
  * @en Page related
  * @zh 页面
  */
declare module '@zos/page' {

  /**
   * @en Free scrolling mode, system default scrolling mode
   * @zh 自由滚动，系统默认滚动模式
   */
  const SCROLL_MODE_FREE: string
  /**
   * @en Swiper mode, vertical rotating map, walking lights, by configuring the height and number of individual pages can achieve the whole screen scrolling effect
   * @zh Swiper 模式，竖向轮播图、走马灯，通过配置单个页面高度和数量可以做到整屏滚动效果
   */
  const SCROLL_MODE_SWIPER: string
  /**
   * @en Swiper mode, horizontal rotating map, walking lights, by configuring the width and number of individual pages can achieve the whole screen scrolling effect
   * @zh Swiper 模式，横向轮播图、走马灯，通过配置单个页面宽度和数量可以做到整屏滚动效果
   * @version 2.1
   */
  const SCROLL_MODE_SWIPER_HORIZONTAL: string
  /**
   * @en Scroll smoothly to the corresponding position
   * @zh 平滑滚动至对应位置
   */
  const SCROLL_ANIMATION_SMOOTH: string
  /**
   * @en No animation, scroll directly to the corresponding position
   * @zh 无动画，直接滚动至对应位置
   */
  const SCROLL_ANIMATION_NONE: string
  namespace scrollTo {
    interface Option {
      /**
       * @en The vertical axis coordinates of the page, the 12 o'clock direction of the watch is positive, and scrolling down is negative
       * @zh 页面的纵轴坐标，手表 12 点钟方向为正方向，即向下滚动为负值
       */
      y: number
      /**
       * @en Scroll animation configuration
       * @zh 滚动动画配置
       * @version 3.6
       */
      animConfig?: animConfig
    }

    interface animConfig {
      /**
       * @en Animation curve, optional values `linear`, `easein`, `easeout`, `easeinout` refer to [https://easings.net/](https://easings.net/)
       * @zh 动画曲线，可选值 `linear`, `easein`, `easeout`, `easeinout`，参考 [https://easings.net/](https://easings.net/)
       * @version 3.6
       */
      anim_rate?: string
      /**
       * @en Animation duration, in milliseconds
       * @zh 动画时长，单位毫秒
       * @version 3.6
       */
      anim_duration?: number
      /**
       * @en Animation frame rate
       * @zh 动画帧率
       * @version 3.6
       * @defaultValue 25
       */
      anim_fps?: number
      /**
       * @en End of animation callback function
       * @zh 动画播放结束回调函数
       * @version 3.6
       */
      anim_complete_func?: () => void
    }
  }

  /**
   * @en Scroll the page to the specified position
   * @zh 滚动页面至指定位置
   * @example
   * ```js
   * import { scrollTo } from '@zos/page'
   *
   * scrollTo({
   *    y: -200
   * })
   * ```
   */
  function scrollTo(option: scrollTo.Option): void
  function scrollTo(y: number): void
  namespace getScrollTop {
    /**
     * @en The vertical coordinate of the current scroll position of the page
     * @zh 垂直坐标
     */
    type Result = number
  }

  /**
   * @en Get the vertical coordinate of the current scroll position of the page
   * @zh 获取页面当前滚动位置的垂直坐标
   * @example
   * ```js
   * import { getScrollTop } from '@zos/page'
   *
   * const top = getScrollTop()
   * console.log(top)
   * ```
   */
  function getScrollTop(): getScrollTop.Result
  namespace setScrollMode {
    interface Option {
      /**
       * @en Page scroll mode, value reference page scroll mode constants
       * @zh 页面滚动模式，值参考页面滚动模式常量
       */
      mode: string
      /**
       * @en Other Options
       * @zh 其他选项
       */
      options?: Options
    }

    interface Options {
      /**
       * @en Specify the height of a single item in Swiper, effective only if the scroll mode is `SCROLL_MODE_SWIPER`
       * @zh 指定 Swiper 中单个项目的高度，仅当页面滚动模式为 `SCROLL_MODE_SWIPER` 生效
       */
      height?: number
      /**
       * @en Specify the number of items in the Swiper, effective only if the scroll mode is `SCROLL_MODE_SWIPER` or `SCROLL_MODE_SWIPER_HORIZONTAL`
       * @zh 指定 Swiper 中项目的数量，仅当页面滚动模式为 `SCROLL_MODE_SWIPER` 和 `SCROLL_MODE_SWIPER_HORIZONTAL` 生效
       */
      count?: number
      /**
       * @en Specify the width of a single item in Swiper, effective only if the scroll mode is `SCROLL_MODE_SWIPER_HORIZONTAL`
       * @zh 指定 Swiper 中单个项目的宽度，仅当页面滚动模式为 `SCROLL_MODE_SWIPER_HORIZONTAL` 生效
       * @version 2.1
       */
      width?: number
      /**
       * @en Parameters for the scroll mode
       * @zh 模式的控制参数
       * @version 3.0
       */
      modeParams?: FreeModeParams | SwipeModeParams
    }

    /**
     * @output
     */
    interface FreeModeParams {
      /**
       * @en The callback function for each frame during scrolling
       * @zh 滚动过程中每帧的回调函数
       * @version 3.0
       */
      scroll_frame_func: (params: ScrollObj) => void
      /**
       * @en The end of the scroll callback function
       * @zh 滚动结束的回调函数
       * @version 3.0
       */
      scroll_complete_func: (params: ScrollObj) => void
      /**
       * @en Control whether the page rebound effect is turned on. When the page content exceeds one screen, it is turned on by default. If the page content is less than one screen, it is turned off by default. This parameter needs to be passed in the `build` lifecycle to take effect.
       * @zh 页面回弹效果是否开启，当页面内容超过一屏，默认开启，页面内容不足一屏，默认关闭，此参数需要在 `build` 生命周期传入才能生效
       * @version 3.6
       */
      bounce?: boolean
    }

    /**
     * @output
     */
    interface ScrollObj {
      /**
       * @en Todo
       * @zh 待补充
       * @version 3.0
       */
      type: number
      /**
       * @en Pixel offset on the y axis
       * @zh y 轴偏移的像素
       * @version 3.0
       */
      yoffset: number
    }

    /**
     * @output
     */
    interface SwipeModeParams {
      /**
       * @en Callback function after page flipping, `pageIndex` is the page index after page flipping, and the index starts from `0`
       * @zh 翻页完成后的回调函数，`pageIndex` 为翻页完成后的页面索引，索引从 0 开始
       * @version 3.0
       */
      on_page: (pageIndex: number) => void
      /**
       * @en Whether to respond to crown events, the default response, you can use the crown to control page turning
       * @zh 是否响应表冠事件，默认响应，可以通过表冠来控制翻页
       * @defaultValue true
       * @version 3.0
       */
      crown_enable: boolean
    }

    /**
     * @en If `true` is returned, success is indicated
     * @zh 如果返回 `true` 则表明成功
     */
    type Result = number
  }

  /**
   * @en Set the scroll mode of the page
   * @zh 设置页面的滚动模式
   * @constants scrollMode
   * @example
   * ```js
   * import { setScrollMode, SCROLL_MODE_SWIPER } from '@zos/page'
   *
   * setScrollMode({
   *   mode: SCROLL_MODE_SWIPER,
   *   options: {
   *     height: 480,
   *     count: 10
   *   }
   * })
   * ```
   */
  function setScrollMode(option: setScrollMode.Option): setScrollMode.Result
  namespace setScrollLock {
    interface Option {
      /**
       * @en Whether to lock the current page scroll position
       * @zh 是否锁定当前页面滚动位置
       * @defaultValue true
       */
      lock?: boolean
    }
  }

  /**
   * @en Set the current page scrolling position to be locked, i.e. the screen position will not change with the gesture swipe. After calling this API to perform the unlock operation, the page scrolling mode will be set to free scrolling mode
   * @zh 设置当前页面滚动位置锁定，即屏幕位置不会跟随手势滑动改变。调用此 API 执行解锁操作之后，页面滚动模式会设置为自由滚动模式
   * @example
   * ```js
   * import { setScrollLock } from '@zos/page'
   *
   * setScrollLock({
   *   lock: true
   * })
   * ```
   */
  function setScrollLock(option: setScrollLock.Option): void
  namespace swipeToIndex {
    interface Option {
      /**
       * @en Index of the target project, starting from 0
       * @zh 目标项目的索引，从 0 开始
       */
      index: number
      /**
       * @en Scrolling animation, value reference page scrolling animation constants
       * @zh 滚动动画，值参考页面滚动动画常量
       * @defaultValue `SCROLL_ANIMATION_SMOOTH`
       */
      animation?: string
    }
  }

  /**
   * @en Scrolls the page to the Swiper's target item, only if the current page scroll mode is `SCROLL_MODE_SWIPER`
   * @zh 将页面滚动至 Swiper 的目标项目，仅当当前页面滚动模式为 `SCROLL_MODE_SWIPER` 的时候生效
   * @constants scrollAnimation
   * @example
   * ```js
   * import { setScrollMode, swipeToIndex, SCROLL_MODE_SWIPER } from '@zos/page'
   *
   * setScrollMode({
   *   mode: SCROLL_MODE_SWIPER,
   *   options: {
   *     height: 480,
   *     count: 10
   *   }
   * })
   *
   * swipeToIndex({
   *   index: 5
   * })
   * ```
   */
  function swipeToIndex(option: swipeToIndex.Option): void
  namespace getSwiperIndex {
    /**
     * @en If the page scroll mode is `SCROLL_MODE_SWIPER` or `SCROLL_MODE_SWIPER_HORIZONTAL`, the value is the index of the current item (starting from `1`). Otherwise, it is `undefined`.
     * @zh 页面滚动模式为 `SCROLL_MODE_SWIPER` 或 `SCROLL_MODE_SWIPER_HORIZONTAL` 时，值为当前项目的索引（从 `1` 开始）。否则为 `undefined`
     */
    type Result = number | undefined
  }

  /**
   * @en Get the scroll position of the current page, only if the page scroll mode is `SCROLL_MODE_SWIPER` or `SCROLL_MODE_SWIPER_HORIZONTAL` return the index of the current item (starting from `1`), otherwise return `undefined`
   * @zh 获取当前页面的滚动位置，仅当页面滚动模式为 `SCROLL_MODE_SWIPER` 或 `SCROLL_MODE_SWIPER_HORIZONTAL` 返回当前项目的索引（从 `1` 开始），否则返回 `undefined`
   * @example
   * ```js
   * import { setScrollMode, swipeToIndex, getSwiperIndex, SCROLL_MODE_SWIPER } from '@zos/page'
   *
   * setScrollMode({
   *   mode: SCROLL_MODE_SWIPER,
   *   options: {
   *     height: 480,
   *     count: 10
   *   }
   * })
   *
   * swipeToIndex({
   *   index: 5
   * })
   *
   * const currentIndex = getSwiperIndex()
   * console.log(currentIndex)
   * ```
   */
  function getSwiperIndex(): getSwiperIndex.Result
}

/**
  * @en Router
  * @zh 路由
  */
declare module '@zos/router' {

  /**
   * @en Activity
   * @zh 今日活动
   * @version 3.0
   */
  const SYSTEM_APP_STATUS: number

  /**
   * @en Heart Rate
   * @zh 心率
   * @version 3.0
   */
  const SYSTEM_APP_HR: number

  /**
   * @en Workout
   * @zh 运动
   * @version 3.0
   */
  const SYSTEM_APP_SPORT: number

  /**
   * @en Weather
   * @zh 天气
   * @version 3.0
   */
  const SYSTEM_APP_WEATHER: number

  /**
   * @en Alarm
   * @zh 闹钟
   * @version 3.0
   */
  const SYSTEM_APP_ALARM: number

  /**
   * @en Camera Remote
   * @zh 遥控拍照
   * @version 3.0
   */
  const SYSTEM_APP_CAMERA: number

  /**
   * @en Music
   * @zh 音乐
   * @version 3.0
   */
  const SYSTEM_APP_MUSIC: number

  /**
   * @en Stopwatch
   * @zh 秒表
   * @version 3.0
   */
  const SYSTEM_APP_STOPWATCH: number

  /**
   * @en Timer
   * @zh 倒计时
   * @version 3.0
   */
  const SYSTEM_APP_COUNTDOWN: number

  /**
   * @en Find My Phone
   * @zh 查找手机
   * @version 3.0
   */
  const SYSTEM_APP_FINE_PHONE: number

  /**
   * @en Cards
   * @zh 卡包
   * @version 3.0
   */
  const SYSTEM_APP_CARD: number

  /**
   * @en Alipay
   * @zh 支付宝
   * @version 3.0
   */
  const SYSTEM_APP_ALIPAY: number

  /**
   * @en Settings
   * @zh 设置
   * @version 3.0
   */
  const SYSTEM_APP_SETTING: number

  /**
   * @en Workout History
   * @zh 运动记录
   * @version 3.0
   */
  const SYSTEM_APP_SPORT_HISTORY: number

  /**
   * @en Compass
   * @zh 指南针
   * @version 3.0
   */
  const SYSTEM_APP_COMPASS: number

  /**
   * @en PAI
   * @zh PAI
   * @version 3.0
   */
  const SYSTEM_APP_PAI: number

  /**
   * @en World Clock
   * @zh 世界时钟
   * @version 3.0
   */
  const SYSTEM_APP_WORLD_CLOCK: number

  /**
   * @en Stress
   * @zh 压力
   * @version 3.0
   */
  const SYSTEM_APP_PRESSURE: number

  /**
   * @en Cycle Tracking
   * @zh 生理周期
   * @version 3.0
   */
  const SYSTEM_APP_MENSTRUAL: number

  /**
   * @en Workout Status
   * @zh 运动状态
   * @version 3.0
   */
  const SYSTEM_APP_SPORT_STATUS: number

  /**
   * @en Calendar
   * @zh 日历
   * @version 3.0
   */
  const SYSTEM_APP_CALENDAR: number

  /**
   * @en Sleep
   * @zh 睡眠
   * @version 3.0
   */
  const SYSTEM_APP_SLEEP: number

  /**
   * @en Blood Oxygen
   * @zh 血氧
   * @version 3.0
   */
  const SYSTEM_APP_SPO2: number

  /**
   * @en Phone
   * @zh 电话
   * @version 3.0
   */
  const SYSTEM_APP_PHONE: number

  /**
   * @en NetEase Music
   * @zh 网易云音乐
   * @version 3.0
   */
  const SYSTEM_APP_NETEASE_MUSIC: number

  /**
   * @en Weixin Pay
   * @zh 微信支付
   * @version 3.0
   */
  const SYSTEM_APP_WEPAY: number

  /**
   * @en Breathe
   * @zh 呼吸
   * @version 3.0
   */
  const SYSTEM_APP_BREATH: number

  /**
   * @en Pomodoro Timer
   * @zh 番茄钟
   * @version 3.0
   */
  const SYSTEM_APP_POMODORO: number

  /**
   * @en Alexa
   * @zh Alexa
   * @version 3.0
   */
  const SYSTEM_APP_ALEAX: number

  /**
   * @en Thermometer
   * @zh 温度计
   * @version 3.0
   */
  const SYSTEM_APP_THERMOMETER: number

  /**
   * @en To Do
   * @zh 待办事项
   * @version 3.0
   */
  const SYSTEM_APP_TODO_LIST: number

  /**
   * @en Barometer
   * @zh 气压高度计
   * @version 3.0
   */
  const SYSTEM_APP_ALTIMETER: number

  /**
   * @en Voice Memos
   * @zh 语音备忘录
   * @version 3.0
   */
  const SYSTEM_APP_VOICE_MEMO: number

  /**
   * @en Sun & Moon
   * @zh 太阳和月亮
   * @version 3.0
   */
  const SYSTEM_APP_SUN_AND_MOON: number

  /**
   * @en One-tap Measuring
   * @zh 一键测量
   * @version 3.0
   */
  const SYSTEM_APP_MEASUREMENT: number

  /**
   * @en Zepp Coach
   * @zh Zepp 运动教练
   * @version 3.0
   */
  const SYSTEM_APP_ZEPP_COACH: number

  /**
   * @en Membership Card
   * @zh 会员卡
   * @version 3.0
   */
  const SYSTEM_APP_CLUB_CARD: number

  /**
   * @en Body Composition
   * @zh 身体成分
   * @version 3.0
   */
  const SYSTEM_APP_BODY_COMPOSITION: number

  /**
   * @en Readiness
   * @zh 身心准备度
   * @version 3.0
   */
  const SYSTEM_APP_READINESS: number
  namespace launchApp {
    interface Option {
      /**
       * @en Mini Program ID or System App ID (API_LEVEL 3.0 support, value reference System App ID constant)
       * @zh 小程序 ID 或系统应用 ID（API_LEVEL 3.0 支持，值参考系统应用 ID 常量）
       */
      appId: number
      /**
       * @en path
       * @zh 页面路径
       */
      url: string
      /**
       * @en Whether to jump to the system App
       * @zh 是否跳转系统应用
       * @default false
       * @version 3.0
       */
      native: boolean
      /**
       * @en The argument passed to the app.js lifecycle `onCreate` supports either a string or a standard JSON object. If a standard JSON object is passed, the method internally converts it to a string
       * @zh 传递给 app.js 生命周期 `onCreate` 中的参数，支持字符串或者标准 JSON 对象。如果传递标准 JSON 对象，该方法内部会将其转为字符串
       */
      params?: string | object
    }
  }

  /**
   * @en Open Mini Program
   * @zh 打开小程序
   * @constants system_app
   * @example
   * ```js
   * import { launchApp, SYSTEM_APP_HR } from '@zos/router'
   *
   * // Jump to Mini Program
   * launchApp({
   *    appId: 1000001,
   *    url: 'pages/js_widget_sample',
   *    params: {
   *      type: 1
   *   }
   * })
   *
   * // Jump to system App Heart Rate
   * launchApp({
   *    appId: SYSTEM_APP_HR,
   *    native: true
   * })
   * ```
   */
  function launchApp(option: launchApp.Option): void
  namespace push {
    interface Option {
      /**
       * @en path
       * @zh 页面路径
       */
      url: string
      /**
       * @en Parameters passed to the page `onInit` lifecycle, supporting strings or standard JSON object. If a standard JSON object is passed, the method internally converts it to a string
       * @zh 传递给 page.js `onInit` 生命周期中的参数，支持字符串或者标准 JSON 对象。如果传递标准 JSON 对象，该方法内部会将其转为字符串
       */
      params?: string | object
    }
  }

  /**
   * @zh
   * 跳转到小程序内的某个页面，使用 `back` 方法可以回到原页面
   * @en
   * Navigate to a page within the Mini Program. Use the `back` method to go back to the original page
   * @example
   * ```js
   * import { push } from '@zos/router'
   *
   * push({
   *    url: 'page/index',
   *    params: 'type=1'
   * })
   * ```
   */
  function push(option: push.Option): void
  namespace replace {
    interface Option {
      /**
       * @en path
       * @zh 页面路径
       */
      url: string
      /**
       * @en Parameters passed to the page `onCreate` lifecycle, supporting strings or standard JSON objects. If a standard JSON object is passed, the method internally converts it to a string
       * @zh 传递给 page.js `onInit` 生命周期中的参数，支持字符串或者标准 JSON 对象。如果传递标准 JSON 对象，该方法内部会将其转为字符串
       */
      params?: string | object
    }
  }

  /**
   * @zh
   * 关闭当前页面，跳转到小程序内的某个页面
   * @en
   * Close the current page and jump to a page within the app
   * @example
   * ```js
   * import { replace } from '@zos/router'
   *
   * replace({
   *    url: 'page/index',
   *    params: 'type=1'
   * })
   * ```
   */
  function replace(option: replace.Option): void
  /**
   * @zh
   * 退出小程序，返回至表盘页面
   * @en
   * Exit the Mini Program and return to the watchface page
   * @example
   * ```js
   * import { home } from '@zos/router'
   *
   * home()
   * ```
   */
  function home(): void
  /**
   * @zh
   * 关闭当前页面，返回上一页面
   * @en
   * Closes the current page to return to the previous page
   * @example
   * ```js
   * import { back } from '@zos/router'
   *
   * back()
   * ```
   */
  function back(): void
  /**
   * @zh
   * 关闭当前小程序，回到应用列表页面
   * @en
   * Exit the Mini Program and return to the applist page
   * @example
   * ```js
   * import { exit } from '@zos/router'
   *
   * exit()
   * ```
   */
  function exit(): void
  namespace setLaunchAppTimeout {
    interface Option {
      /**
       * @en Mini Program ID
       * @zh 小程序 ID
       */
      appId: number
      /**
       * @en path
       * @zh 页面路径
       */
      url: string
      /**
       * @en utc timestamp(milliseconds)，the priority is higher than `delay`, and when set at the same time as the `delay` field, only the `utc` field takes effect
       * @zh utc 时间戳（毫秒），优先级高于 `delay`，当与 `delay` 字段同时设置的时候，只有 `utc` 字段生效
       */
      utc?: number
      /**
       * @en The time, in milliseconds that the timer should wait before the Mini Program is waked.
       * @zh 等待时间（毫秒）
       * @version 3.0
       * @defaultValue 0
       */
      delay?: number
      /**
       * @en The argument passed to the app.js lifecycle `onCreate` supports either a string or a standard JSON object. If a standard JSON object is passed, the method internally converts it to a string
       * @zh 传递给 app.js 生命周期 `onCreate` 中的参数，支持字符串或者标准 JSON 对象。如果传递标准 JSON 对象，该方法内部会将其转为字符串
       */
      params?: string | object
    }

    /**
     * @en The returned value is a positive integer value which identifies the timer created by the call to `setLaunchAppTimeout`. This value can be passed to `clearLaunchAppTimeout` to cancel the timeout.
     * @zh 表示定时器的编号，这个值可以传递给 `clearLaunchAppTimeout` 来取消定时器
     */
    type Result = number
  }

  /**
   * @en Register a timer to launch the Mini Program at a given time
   * @zh 注册一个定时器，定时唤起小程序，在此期间如果设备重启，则定时器会失效
   * @example
   * ```js
   * import { setLaunchAppTimeout, clearLaunchAppTimeout } from '@zos/router'
   *
   * const timeoutId = setLaunchAppTimeout({
   *   url: 'pages/js_widget_sample',
   *   appId: 1000001,
   *   delay: 1000
   * })
   *
   * clearLaunchAppTimeout({
   *   timeoutId
   * })
   * ```
   */
  function setLaunchAppTimeout(option: setLaunchAppTimeout.Option): setLaunchAppTimeout.Result
  namespace clearLaunchAppTimeout {
    interface Option {
      /**
       * @en The identifier of the timeout you want to cancel. This ID was returned by the corresponding call to `setLaunchAppTimeout`()
       * @zh 需要取消的唤醒小程序定时器的编号，这个值通过 `setLaunchAppTimeout` 返回
       */
      timeoutId: number
    }

    /**
     * @en The returned value is a positive integer value which identifies the timer created by the call to `setLaunchAppTimeout`. This value can be passed to `clearLaunchAppTimeout` to cancel the timeout
     * @zh 表示定时器的编号，这个值可以传递给 `clearLaunchAppTimeout` 来取消定时器
     */
    type Result = number
  }

  /**
   * @en Cancel the wakeup Mini Program timer created by `setLaunchAppTimeout`
   * @zh 取消 `setLaunchAppTimeout` 创建的唤醒小程序定时器
   * @example
   * ```js
   * import { setLaunchAppTimeout, clearLaunchAppTimeout } from '@zos/router'
   *
   * const timeoutId = setLaunchAppTimeout({
   *   url: 'pages/js_widget_sample',
   *   appId: 1000001,
   *   delay: 10000
   * })
   *
   * clearLaunchAppTimeout({
   *   timeoutId
   * })
   * ```
   */
  function clearLaunchAppTimeout(option: clearLaunchAppTimeout.Option): void
  function clearLaunchAppTimeout(timeoutId: number): void
  namespace checkSystemApp {
    interface Option {
      /**
       * @en ID of the system App to be jumped to, value refers to the system App ID constant
       * @zh 需要跳转的系统应用 ID，值参考系统应用 ID 常量
       */
      appId: number
    }
  }

  /**
   * @en Check if the system application supports jumping
   * @zh 检查系统应用是否支持跳转
   * @constants system_app
   * @version 3.0
   * @example
   * ```js
   * import { checkSystemApp, SYSTEM_APP_STATUS } from '@zos/router'
   *
   * checkSystemApp({
   *   appId: SYSTEM_APP_STATUS
   * })
   * ```
   */
  function checkSystemApp(option: checkSystemApp.Option): void
  function checkSystemApp(appId: number): void
  namespace getAppIdByName {
    /**
     * @en Matched Mini Program ID, returns invalid ID when match fails
     * @zh 匹配到的小程序 ID，未成功匹配时返回无效 ID
     */
    type Result = number
  }

  /**
   * @en Fuzzy match the English name of installed Mini Programs on the device by name
   * @zh 根据名称模糊匹配设备端已安装小程序的英文名称
   * @version 3.6
   * @example
   * ```js
   * import { getAppIdByName } from '@zos/router'
   *
   * const appId = getAppIdByName('calculator')
   * console.log(appId)
   * ```
   */
  function getAppIdByName(name: string): getAppIdByName.Result
}

/**
  * @en Sensor
  * @zh 传感器
  */
declare module '@zos/sensor' {

  /**
   * @en Light vibration intensity and short time (20ms)
   * @zh 振动强度轻，时间较短（20ms）
   */
  const VIBRATOR_SCENE_SHORT_LIGHT: number
  /**
   * @en Medium vibration intensity, short time (20ms)
   * @zh 振动强度中等，时间较短（20ms）
   */
  const VIBRATOR_SCENE_SHORT_MIDDLE: number
  /**
   * @en High vibration intensity and short time (20ms)
   * @zh 振动强度高，时间较短（20ms）
   */
  const VIBRATOR_SCENE_SHORT_STRONG: number
  /**
   * @en High vibration intensity, lasting 600ms
   * @zh 振动强度高，持续 600ms
   */
  const VIBRATOR_SCENE_DURATION: number
  /**
   * @en High vibration intensity, lasting 1000ms
   * @zh 振动强度高，持续 1000ms
   */
  const VIBRATOR_SCENE_DURATION_LONG: number
  /**
   * @en High vibration intensity, four vibrations in 1200ms, can be used for stronger reminders
   * @zh 振动强度高，1200ms 内振动四次，用于较强提醒
   */
  const VIBRATOR_SCENE_STRONG_REMINDER: number
  /**
   * @en Two short, continuous vibrations, consistent with the watch message notification vibration feedback
   * @zh 短促振动两次，与手表消息通知振动反馈一致
   */
  const VIBRATOR_SCENE_NOTIFICATION: number
  /**
   * @en High vibration intensity, single vibration twice in 500ms, continuous vibration, need to manually `stop`, consistent with the watch call vibration feedback
   * @zh 振动强度高，单次 500ms 内振动两次，持续振动，需要手动 `stop` 才会停止，与手表来电振动反馈一致
   */
  const VIBRATOR_SCENE_CALL: number
  /**
   * @en High vibration intensity, single long vibration 500ms, continuous vibration, need to manually `stop`, consistent with the watch alarm clock, countdown vibration feedback
   * @zh 振动强度高，单次长振动 500ms，持续振动，需要手动 `stop` 才会停止，与手表闹钟、倒计时振动反馈一致
   */
  const VIBRATOR_SCENE_TIMER: number
  /**
   * @en 12-hour format
   * @zh 12 小时制
   * @version 2.1
   */
  const TIME_HOUR_FORMAT_12: number
  /**
   * @en 24-hour format
   * @zh 24 小时制
   * @version 2.1
   */
  const TIME_HOUR_FORMAT_24: number
  /**
   * @en Low power mode with low trigger frequency
   * @zh 低功耗模式，触发频率低
   * @version 3.0
   */
  const FREQ_MODE_LOW: number
  /**
   * @en Normal power consumption mode, medium trigger frequency
   * @zh 正常功耗模式，触发频率中等
   * @version 3.0
   */
  const FREQ_MODE_NORMAL: number
  /**
   * @en High power consumption mode with high trigger frequency
   * @zh 高功耗模式，触发频率高
   * @version 3.0
   */
  const FREQ_MODE_HIGH: number
  namespace Time {
    namespace getLunarMonthCalendar {
      /**
       * @output
       */
      interface LunarMonthCalendar {
        /**
         * @en Number of days in the current month
         * @zh 当前月的天数
         */
        day_count: number
        /**
         * @en Array of display content for each day of the current month, display content priority for holidays, Solar Term, date
         * @zh 当前月每一天展示内容数组，展示内容优先级为节日、节气、日期
         */
        lunar_days_array: Array<string>
      }
    }
  }

  /**
   * @en Time/Date Sensor
   * @zh 时间/日期传感器
   * @example
   * ```js
   * import { Time } from '@zos/sensor'
   *
   * const time = new Time()
   * const currentTime = time.getTime()
   * ```
   */
  class Time {
    /**
     * @en Gets the UTC timestamp in milliseconds
     * @zh 获取 UTC 时间戳，单位毫秒
     */
    getTime(): number
    /**
     * @en Get the year of the current date
     * @zh 获取当前日期的年份
     */
    getFullYear(): number
    /**
     * @en Get the month of the current date, range 1 - 12, return `1` for January
     * @zh 获取当前日期的月份，范围 1 - 12，返回 `1` 代表 1 月
     */
    getMonth(): number
    /**
     * @en Get the number of days of the current date, i.e. the day of the month, in the range 1 - 31
     * @zh 获取当前日期的天数，即一个月中的哪一天，范围 1 - 31
     */
    getDate(): number
    /**
     * @en Get the number of hours of the current time
     * @zh 获取当前时间的小时数
     */
    getHours(): number
    /**
     * @en Get the number of minutes of the current time
     * @zh 获取当前时间的分钟数
     */
    getMinutes(): number
    /**
     * @en Get the number of seconds of the current time
     * @zh 获取当前时间的秒数
     */
    getSeconds(): number
    /**
     * @en Get the current time corresponding to the day of the week, range 1 - 7, return `1` for Monday
     * @zh 获取当前时间对应一周中的第几天，范围 1 - 7，返回 `1` 代表星期一
     */
    getDay(): number
    /**
     * @en Get the current system time format, 12-hour format or 24-hour format，value reference hour format constants
     * @zh 获取当前系统时间格式，12 小时/24 小时，值参考小时格式常量
     * @constants hour_format
     * @version 2.1
     */
    getHourFormat(): number
    /**
     * @en Get the number of hours in the current time format (12-hour format or 24-hour format)
     * @zh 获取当前时间格式（12 小时/24 小时）下的小时数
     * @version 2.1
     */
    getFormatHour(): number
    /**
     * @en Register end-of-minute event listener callback function
     * @zh 注册每分钟结束事件监听回调函数
     * @version 2.1
     */
    onPerMinute(callback: () => void): void
    /**
     * @en Register the end-of-day event listener callback function
     * @zh 注册每天结束事件监听回调函数
     * @version 2.1
     */
    onPerDay(callback: () => void): void
    /**
     * @en Register the end-of-hour event listener callback function
     * @zh 注册每小时结束事件监听回调函数
     * @version 3.6
     */
    onPerHourEnd(callback: () => void): void
    /**
     * @en Get gregorian holidays, or return the string `'INVALID'` if there is no holiday
     * @zh 获取公历节日，如果没有节日，则返回字符串 `'INVALID'`
     */
    getFestival(): string
    /**
     * @en Get Chinese lunar year, only works when system language is set to Chinese
     * @zh 获取中国农历年份，仅在系统语言设置为中文时生效
     */
    getLunarYear(): number
    /**
     * @en Get Chinese lunar month, only works when system language is set to Chinese
     * @zh 获取中国农历月份，仅在系统语言设置为中文时生效
     */
    getLunarMonth(): number
    /**
     * @en Get Chinese lunar day, only works when system language is set to Chinese
     * @zh 获取中国农历日期，仅在系统语言设置为中文时生效
     */
    getLunarDay(): number
    /**
     * @en Get Chinese lunar holidays, only works when system language is set to Chinese, or return the string `'INVALID'` if there is no holiday
     * @zh 获取中国农历节日，仅在系统语言设置为中文时生效，如果没有节日，则返回字符串 `'INVALID'`
     */
    getLunarFestival(): string
    /**
     * @en Get Traditional Chinese Solar Terms, only works when system language is set to Chinese, or return the string `'INVALID'` if there is no Solar Term
     * @zh 获取中国农历节气，仅在系统语言设置为中文时生效，如果没有节气，则返回字符串 `'INVALID'`
     */
    getSolarTerm(): string
    /**
     * @en Get the holiday strings displayed on that day, the priority is Gregorian holidays, Chinese lunar holidays, Chinese lunar festivals in that order, only when the system language is set to Chinese
     * @zh 获取当天显示的节日字符串，仅在系统语言设置为中文时生效，优先级依次是公历节日、中国农历节日、中国农历节气，
     */
    getShowFestival(): string
    /**
     * @en Get the monthly calendar information of the current month of Chinese lunar calendar, only works when the system language is set to Chinese
     * @zh 获取中国农历当前月的月历信息，仅在系统语言设置为中文时生效
     */
    getLunarMonthCalendar(): Time.getLunarMonthCalendar.LunarMonthCalendar
    /**
     * @en Register the Sunrise event listener callback function to take effect only when the device weather information
     * @zh 注册日出事件监听回调函数，仅当设备天气信息时才会生效
     * @version 3.0
     */
    onSunrise(callback: () => void): void
    /**
     * @en Register the Sunset event listener callback function to take effect only when the device weather information
     * @zh 注册日落事件监听回调函数，仅当设备天气信息时才会生效
     * @version 3.0
     */
    onSunset(callback: () => void): void
    /**
     * @en Register the phone modify time event listening callback function
     * @zh 注册手机修改时间事件监听回调函数
     * @version 3.0
     */
    onPhoneTimeSetting(callback: () => void): void
  }
  /**
   * @en Battery Sensor
   * @zh 电量传感器
   * @example
   * ```js
   * import { Battery } from '@zos/sensor'
   *
   * const battery = new Battery()
   * const current = battery.getCurrent()
   *
   * const callback = () => {
   *   console.log(battery.getCurrent())
   * }
   *
   * battery.onChange(callback)
   *
   * // When not needed for use
   * battery.offChange(callback)
   * ```
   */
  class Battery {
    /**
     * @en Get the current device power percentage, range 0 - 100
     * @zh 获取当前设备电量百分比，范围 0 - 100
     */
    getCurrent(): number
    /**
     * @en Register the power change event callback function
     * @zh 注册电量变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the power change event callback function
     * @zh 取消电量变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  /**
   * @en Step Sensor
   * @zh 步数传感器
   * @permissionCode data:user.hd.step
   * @example
   * ```js
   * import { Step } from '@zos/sensor'
   *
   * const step = new Step()
   * const current = step.getCurrent()
   * const target = step.getTarget()
   * const callback = () => {
   *   console.log(step.getCurrent())
   * }
   *
   * step.onChange(callback)
   *
   * // When not needed for use
   * step.offChange(callback)
   * ```
   */
  class Step {
    /**
     * @en Get the current step count
     * @zh 获取当前步数
     */
    getCurrent(): number
    /**
     * @en Get step goal
     * @zh 获取步数目标
     */
    getTarget(): number
    /**
     * @en Register the step change event callback function
     * @zh 注册步数变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the step change event callback function
     * @zh 取消步数变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  /**
   * @en Calorie Sensor
   * @zh 卡路里传感器
   * @permissionCode data:user.hd.calorie
   * @example
   * ```js
   * import { Calorie } from '@zos/sensor'
   *
   * const calorie = new Calorie()
   * const current = calorie.getCurrent()
   * const target = calorie.getTarget()
   * const callback = () => {
   *   console.log(calorie.getCurrent())
   * }
   *
   * calorie.onChange(callback)
   *
   * // When not needed for use
   * calorie.offChange(callback)
   * ```
   */
  class Calorie {
    /**
     * @en Get the current calorie consumption in kcal
     * @zh 获取当前消耗卡路里，单位 kcal
     */
    getCurrent(): number
    /**
     * @en Get the target calorie consumption in kcal
     * @zh 获取目标消耗卡路里，单位 kcal
     */
    getTarget(): number
    /**
     * @en Register the calories change event callback function
     * @zh 注册卡路里消耗变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the calories change event callback function
     * @zh 取消卡路里消耗变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  namespace HeartRate {
    namespace getDailySummary {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Maximum heart rate information
         * @zh 最高心率信息
         */
        maximum: Maximum
      }

      /**
       * @output
       */
      interface Maximum {
        /**
         * @en Maximum heart rate value
         * @zh 最高心率值
         */
        hr_value: number
        /**
         * @en Measurement time of maximum heart rate
         * @zh 最高心率的测量时间
         */
        time: number
      }
    }

    namespace getAFibRecord {
      /**
       * @en Atrial Fibrillation Information Array
       * @zh 房颤信息数组
       */
      type Result = Array<AfibInfo>

      /**
       * @output
       */
      interface AfibInfo {
        /**
         * @en Atrial fibrillation test results, `0` - normal, `1` - high alert, `2` - low alert, `3` - atrial fibrillation
         * @zh 房颤检测结果，`0` - 正常、`1` - 高预警、`2` - 低预警、`3` - 房颤
         */
        flag: number
        /**
         * @en Atrial fibrillation data value, integer value 0 - 255
         * @zh 房颤数据值，值为 0 - 255 的整数
         */
        val: number
        /**
         * @en Atrial fibrillation data maximum value, integer value 0 - 255
         * @zh 房颤数据最大值，值为 0 - 255 的整数
         */
        maxValue: number
        /**
         * @en Atrial fibrillation data minimum value, integer value 0 - 255
         * @zh 房颤数据最小值，值为 0 - 255 的整数
         */
        minValue: number
        /**
         * @en Time of Atrial fibrillation data acquisition, UTC seconds
         * @zh 房颤数据采集的时间，UTC 秒
         */
        time: number
        /**
         * @en Duration in seconds
         * @zh 持续时间，单位秒
         */
        duration: number
      }
    }
  }

  /**
   * @en HeartRate Sensor
   * @zh 心率传感器
   * @permissionCode data:user.hd.heart_rate
   * @example
   * ```js
   * import { HeartRate } from '@zos/sensor'
   *
   * const heartRate = new HeartRate()
   * const lastValue = heartRate.getLast()
   *
   * const callback = () => {
   *   console.log(heartRate.getCurrent())
   * }
   *
   * heartRate.onCurrentChange(callback)
   *
   * // When not needed for use
   * heartRate.offCurrentChange(callback)
   * ```
   */
  class HeartRate {
    /**
     * @en Get the current heart rate measurement, this method needs to be used in the `onCurrentChange` callback function
     * @zh 获取最近一次心率持续测量的测量值，此方法需要在 `onCurrentChange` 回调函数中使用，注册 `onCurrentChange` 事件后，设备会开启心率持续测量，以一定频率更新心率持续测量的测量值
     */
    getCurrent(): number
    /**
     * @en Get the most recent heart rate measurement (single measurement or heart rate monitoring measurement, continuous heart rate measurement `onCurrentChange` results are not counted)
     * @zh 获取最近一次的心率测量值。设备心率自动监测会更新心率测量值，注册 `onCurrentChange` 后设备开始持续测量心率，也会更新心率测量值
     */
    getLast(): number
    /**
     * @en Get the heart rate measurement data in minutes from 0:00 to the current moment of the day, the longest array is 60*24
     * @zh 获取当日自 0 时起至当前时刻以分钟计的心率测量值数据，数组最长为 60*24
     */
    getToday(): Array<number>
    /**
     * @en Call this method and start measuring heart rate continuously, call the callback function when there is a measurement result, call the `getCurrent` method in the callback function to get the heart rate measurement value, if you want to stop the heart rate measurement, you need to call the `offCurrentChange` method
     * @zh 调用此方法后设备开始心率持续测量，并注册回调函数，当有测量结果时调用回调函数，在回调函数中调用 `getCurrent` 方法可以获取心率持续测量的测量值，如需停止持续心率测量，需要调用 `offCurrentChange` 方法
     * @version 2.1
     */
    onCurrentChange(callback: () => void): void
    /**
     * @en Cancel continuous heart rate measurement and cancel callback function listeners
     * @zh 取消持续心率测量，并取消回调函数监听
     * @version 2.1
     */
    offCurrentChange(callback: () => void): void
    /**
     * @en Register the heart rate single measurement change event callback function
     * @zh 注册心率测量值变化事件回调函数
     * @version 2.1
     */
    onLastChange(callback: () => void): void
    /**
     * @en Cancel the heart rate single measurement change event callback function
     * @zh 取消心率测量值变化事件回调函数
     * @version 2.1
     */
    offLastChange(callback: () => void): void
    /**
     * @en Get daily heart rate statistics
     * @zh 获取心率日统计数据
     * @version 3.0
     */
    getDailySummary(): HeartRate.getDailySummary.Result
    /**
     * @en Get current resting heart rate
     * @zh 获取当前静息心率
     * @version 3.0
     */
    getResting(): number
    /**
     * @en Get Atrial Fibrillation Data Array
     * @zh 获取房颤数据数组
     * @version 3.0
     */
    getAFibRecord(): HeartRate.getAFibRecord.Result
    /**
     * @en After calling this method, the device starts real-time resting heart rate measurement and registers a callback function, which is called when there is a measurement result, in which the `getResting` method can be called to get the resting heart rate measurement value, and if you need to stop the resting heart rate measurement, you need to call the `offRestingChange` method
     * @zh 调用此方法后设备开始实时静息心率测量，并注册回调函数，当有测量结果时调用回调函数，在回调函数中调用 `getResting` 方法可以获取静息心率测量值，如需停止静息心率测量，需要调用 `offRestingChange` 方法
     * @version 3.0
     */
    onRestingChange(callback: () => void): void
    /**
     * @en Cancel continuous resting heart rate measurement and cancel callback function listeners
     * @zh 取消静息心率持续测量，并取消回调函数监听
     * @version 3.0
     */
    offRestingChange(callback: () => void): void
  }
  /**
   * @en PAI Sensor
   * @zh PAI 传感器
   * @permissionCode data:user.hd.pai
   * @example
   * ```js
   * import { Pai } from '@zos/sensor'
   *
   * const pai = new Pai()
   * const total = pai.getTotal()
   * const today = pai.getToday()
   * const lastWeek = pai.getLastWeek()
   * ```
   */
  class Pai {
    /**
     * @en Get the current cumulative PAI value
     * @zh 获取当前累计的 PAI 值
     */
    getTotal(): number
    /**
     * @en Get the PAI values obtained today
     * @zh 获取今日获取的 PAI 值
     */
    getToday(): number
    /**
     * @en Get the PAI data for the past 7 days, the return value is an array of length `7`, the position of index `0` is the PAI value of today, the position of index `1` is the PAI value of the previous day, and so on
     * @zh 获取过去 `7` 天的 PAI 数据，返回值为长度为 `7` 的数组，数组索引 `0` 的位置为今天的 PAI 值，索引 `1` 的位置为前 1 天的 PAI 值，以此类推
     */
    getLastWeek(): Array<number>
  }
  /**
   * @en Distance Sensor
   * @zh 里程传感器
   * @permissionCode data:user.hd.distance
   * @example
   * ```js
   * import { Distance } from '@zos/sensor'
   *
   * const distance = new Distance()
   * const current = distance.getCurrent()
   * const callback = () => {
   *   console.log(distance.getCurrent())
   * }
   *
   * distance.onChange(callback)
   *
   * // When not needed for use
   * distance.offChange(callback)
   * ```
   */
  class Distance {
    /**
     * @en Get the current distance
     * @zh 获取当前里程
     */
    getCurrent(): number
    /**
     * @en Register the distance change event callback function
     * @zh 注册里程变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the distance change event callback function
     * @zh 取消里程变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  /**
   * @en Standing behavior Sensor
   * @zh 站立行为传感器
   * @permissionCode data:user.hd.stand
   * @example
   * ```js
   * import { Stand } from '@zos/sensor'
   *
   * const stand = new Stand()
   * const current = stand.getCurrent()
   * const target = stand.getTarget()
   * const callback = () => {
   *   console.log(stand.getCurrent())
   * }
   *
   * stand.onChange(callback)
   *
   * // When not needed for use
   * stand.offChange(callback)
   * ```
   */
  class Stand {
    /**
     * @en Get the current number of hours with standing behavior
     * @zh 获取当前有站立行为的小时数
     */
    getCurrent(): number
    /**
     * @en Get the number of hours with standing behavior targets
     * @zh 获取有站立行为目标的小时数
     */
    getTarget(): number
    /**
     * @en Register a callback function to listen for changes in the number of hours of standing behavior
     * @zh 注册站立行为小时数变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel a callback function to listen for changes in the number of hours of standing behavior
     * @zh 取消站立行为小时数变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  /**
   * @en FatBurning Sensor
   * @zh 脂肪燃烧传感器
   * @permissionCode data:user.hd.fat_burning
   * @example
   * ```js
   * import { FatBurning } from '@zos/sensor'
   *
   * const fatBurning = new FatBurning()
   * const current = fatBurning.getCurrent()
   * const target = fatBurning.getTarget()
   * const callback = () => {
   *   console.log(fatBurning.getCurrent())
   * }
   *
   * fatBurning.onChange(callback)
   *
   * // When not needed for use
   * fatBurning.offChange(callback)
   * ```
   */
  class FatBurning {
    /**
     * @en Get current fat burning minutes
     * @zh 获取当前燃脂分钟数
     */
    getCurrent(): number
    /**
     * @en Get current fat burning target minutes
     * @zh 获取当前燃脂目标分钟数
     */
    getTarget(): number
    /**
     * @en Register a callback function to listen to the fat burning minutes change event
     * @zh 注册燃脂分钟数变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel a callback function to listen to the fat burning minutes change event
     * @zh 取消燃脂分钟数变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  namespace BloodOxygen {
    namespace getCurrent {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Blood oxygen measurement values
         * @zh 血氧测量值
         */
        value: number
        /**
         * @en Measurement time
         * @zh 测量时间
         */
        time: number
        /**
         * @en Result code, refer to retCode description
         * @zh 结果返回码，参考 retCode 描述
         */
        retCode: number
      }

      /**
       * @output
       * @enum
       */
      interface retCode {
        /**
         * @en Measurement invalid
         * @zh 测量无效
         */
        0: number
        /**
         * @en Continue measuring
         * @zh 继续测量
         */
        1: number
        /**
         * @en Measurement success
         * @zh 测量成功
         */
        2: number
        /**
         * @en Measurement failure
         * @zh 测量失败
         */
        3: number
        /**
         * @en Not wearing
         * @zh 没有佩戴
         */
        4: number
        /**
         * @en Measurement timeout
         * @zh 测量超时
         */
        5: number
        /**
         * @en Invalid wearing
         * @zh 无效佩戴
         */
        6: number
        /**
         * @en Invalid signal
         * @zh 信号无效
         */
        7: number
        /**
         * @en Low blood oxygen value
         * @zh 血氧值偏低
         */
        8: number
        /**
         * @en High blood oxygen value
         * @zh 血氧值偏高
         */
        9: number
        /**
         * @en Measurement invalid
         * @zh 测量无效
         */
        10: number
      }
    }

    namespace getLastFewHour {
      /**
       * @output
       */
      interface Data {
        /**
         * @en Blood oxygen measurement value
         * @zh 血氧测量值
         */
        spo2: number
        /**
         * @en Time of measurement of blood oxygen values, UTC time stamp in seconds
         * @zh 血氧值的测量时间，单位秒
         */
        time: number
      }
    }
  }
  /**
   * @en Blood oxygen Sensor
   * @zh 血氧传感器
   * @permissionCode data:user.hd.spo2
   * @example
   * ```js
   * import { BloodOxygen } from '@zos/sensor'
   *
   * const bloodOxygen = new BloodOxygen()
   * const { value } = bloodOxygen.getCurrent()
   * const lastDay = bloodOxygen.getLastDay()
   * const callback = () => {
   *   console.log(bloodOxygen.getCurrent())
   * }
   *
   * bloodOxygen.onChange(callback)
   * bloodOxygen.stop()
   * bloodOxygen.start()
   * // When not needed for use
   * bloodOxygen.offChange(callback)
   * ```
   */
  class BloodOxygen {
    /**
     * @en Get the current measured blood oxygen result
     * @zh 获取当前测量的血氧结果
     */
    getCurrent(): BloodOxygen.getCurrent.Result
    /**
     * @en Returns the average blood sample data for the past 24 hours, with an array length of 24
     * @zh 返回过去 24 小时平均血氧数据，数组长度为 24
     */
    getLastDay(): Array<number>
    /**
     * @en Start blood oxygen measurement, it is recommended to call `stop` to stop the last measurement before calling the `start` method
     * @zh 开始血氧测量，建议在调用 `start` 方法前，调用 `stop` 来停止上一次测量
     * @version 2.1
     */
    start(): void
    /**
     * @en Cancel blood oxygen measurement
     * @zh 停止血氧测量
     * @version 2.1
     */
    stop(): void
    /**
     * @en Register a callback function to listen for blood oxygen measurement change events
     * @zh 注册血氧测量值变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel a callback function to listen for blood oxygen measurement change events
     * @zh 取消血氧测量值变化事件监听回调函数
     */
    offChange(callback: () => void): void
    /**
     * @en Obtain blood oxygen measurements for the last `hour` and sort the results in chronological order
     * @zh 获取最近 `hour` 个小时的血氧测量数据，结果按照时间顺序排序
     * @version 3.0
     */
    getLastFewHour(hour: number): Array<BloodOxygen.getLastFewHour.Data>
  }
  namespace Stress {
    namespace getCurrent {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Stress measurement values
         * @zh 压力测量值
         */
        value: number
        /**
         * @en Time to obtain the measured value
         * @zh 得出测量值的时间
         */
        time: number
      }
    }

    namespace getToday {
      /**
       * @output
       */
      interface StressInfo {
        /**
         * @en Pressure value measurement time, UTC time stamp, in seconds
         * @zh 压力值测量时间，UTC 时间戳，单位秒
         */
        second: number
        /**
         * @en Pressure value, `0` means invalid
         * @zh 压力值，`0` 代表无效
         */
        stress: number
      }
    }

    namespace getLastWeekByHour {
      /**
       * @output
       */
      interface StressInfo {
        /**
         * @en Pressure value measurement time, UTC time stamp, in seconds
         * @zh 压力值测量时间，UTC 时间戳，单位秒
         */
        second: number
        /**
         * @en Pressure value, `0` means invalid
         * @zh 压力值，`0` 代表无效
         */
        stress: number
      }
    }
  }
  /**
   * @en Stress Sensor
   * @zh 压力传感器
   * @permissionCode data:user.hd.stress
   * @example
   * ```js
   * import { Stress } from '@zos/sensor'
   *
   * const stress = new Stress()
   * const { value } = stress.getCurrent()
   *
   * const callback = () => {
   *   console.log(stress.getCurrent())
   * }
   *
   * stress.onChange(callback)
   *
   * // When not needed for use
   * stress.offChange(callback)
   * ```
   */
  class Stress {
    /**
     * @en Get the current pressure measurement
     * @zh 获取当前压力测量值
     */
    getCurrent(): Stress.getCurrent.Result
    /**
     * @en Register a callback function to listen for stress measurement change events
     * @zh 注册压力测量值变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel a callback function to listen for stress measurement change events
     * @zh 取消压力测量值变化事件监听回调函数
     */
    offChange(callback: () => void): void
    /**
     * @en Get the pressure measurements for the whole day, recorded every minute, the return value is an array of variable length, the maximum length of the array is 24 * 60
     * @zh 获取全天的压力测量值，每分钟记录一次，返回值为不定长数组，数组长度最大 24 * 60
     * @version 3.0
     */
    getToday(): Array<number>
    /**
     * @en Get the average pressure value for the whole day, the return value is a fixed-length array, the average pressure for each hour, the length of the array is 24
     * @zh 获取全天的压力均值，返回值为定长数组，为每小时的平均压力，数组长度为 24
     * @version 3.0
     */
    getTodayByHour(): Array<number>
    /**
     * @en Get the average pressure value for each day of the past 7 days, the return value is a fixed-length array, the average pressure per day, the length of the array is 7, the position of index 0 represents six days ago, the position of index 6 represents today
     * @zh 获取过去七天每天的压力均值，返回值为定长数组，为每天平均压力，数组长度为 7，索引 0 的位置代表六天前，索引 6 的位置代表今天
     * @version 3.0
     */
    getLastWeek(): Array<number>
    /**
     * @en Get the hourly pressure average for the past 7 days, the return value is a fixed-length array, the length of the array is 7 * 24
     * @zh 获取过去七天每小时的压力平均值，返回值为定长数组，数组长度为 7 * 24
     * @version 3.0
     */
    getLastWeekByHour(): Array<Stress.getLastWeekByHour.StressInfo>
  }
  /**
   * @en Wearing status sensor
   * @zh 佩戴状态传感器
   * @example
   * ```js
   * import { Wear } from '@zos/sensor'
   *
   * const wear = new Wear()
   * const status = wear.getStatus()
   * const callback = () => {
   *   console.log(wear.getStatus())
   * }
   *
   * wear.onChange(callback)
   *
   * // When not needed for use
   * wear.offChange(callback)
   * ```
   */
  class Wear {
    /**
     * @en Get the current device wearing status, `0`: not wearing, `1`: wearing, `2`: in motion, `3`: not sure
     * @zh 获取当前设备佩戴状态，`0`：未佩戴、`1`：佩戴、`2`：运动中、`3`：不确定
     */
    getStatus(): number
    /**
     * @en Register the device wear status change event listening callback function
     * @zh 注册设备佩戴状态变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the device wear status change event listening callback function
     * @zh 取消设备佩戴状态变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  namespace Sleep {
    namespace getInfo {
      /**
       * @output
       */
      interface SleepInfo {
        /**
         * @en Sleep score
         * @zh 睡眠得分
         */
        score: number
        /**
         * @en Deep sleep time (minutes)
         * @zh 深睡眠时间（分钟）
         */
        deepTime: number
        /**
         * @en Sleep onset time, based on the number of minutes at 0:00 of the day
         * @zh 睡眠起始时间，基于当天 0 点的分钟数
         */
        startTime: number
        /**
         * @en Sleep end time, based on the number of minutes at 0:00 of the day
         * @zh 睡眠结束时间，基于当天 0 点的分钟数
         */
        endTime: number
        /**
         * @en Get total sleep time (minutes)
         * @zh 获取睡眠总时间（分钟）
         */
        totalTime: number
      }
    }

    namespace getStageConstantObj {
      /**
       * @output
       */
      interface StageConstants {
        /**
         * @en Awake stage
         * @zh 清醒阶段
         */
        WAKE_STAGE: number
        /**
         * @en Deep sleep time (minutes)
         * @zh REM 阶段
         */
        REM_STAGE: number
        /**
         * @en Light Sleep stage
         * @zh 浅睡眠阶段
         */
        LIGHT_STAGE: number
        /**
         * @en Deep Sleep stage
         * @zh 深睡眠阶段
         */
        DEEP_STAGE: number
      }
    }

    namespace getStage {
      /**
       * @output
       */
      interface StageInfo {
        /**
         * @en Sleep stage type, refer to the constants returned by `getStageConstantObj` for the meaning of the value
         * @zh 睡眠阶段类型，值的含义参考 `getStageConstantObj` 返回的常量
         */
        model: number
        /**
         * @en Sleep stage onset time, based on the number of minutes at 0:00 of the day
         * @zh 睡眠阶段起始时间，基于当天 0 点的分钟数
         */
        start: number
        /**
         * @en Sleep stage end time, based on the number of minutes at 0:00 of the day
         * @zh 睡眠阶段结束时间，基于当天 0 点的分钟数
         */
        stop: number
      }
    }

    namespace getNap {
      /**
       * @output
       */
      interface NapInfo {
        /**
         * @en Nap duration (minutes)
         * @zh 小睡时长（分钟）
         */
        length: number
        /**
         * @en Nap start time, based on the number of minutes at 0:00 of the day
         * @zh 小睡起始时间，基于当天 0 点的分钟数
         */
        start: number
        /**
         * @en Nap end time, based on the number of minutes at 0:00 of the day
         * @zh 小睡结束时间，基于当天 0 点的分钟数
         */
        stop: number
      }
    }
  }

  /**
   * @en Sleep Sensor
   * @zh 睡眠传感器
   * @permissionCode data:user.hd.sleep
   * @example
   * ```js
   * import { Sleep } from '@zos/sensor'
   *
   * const sleep = new Sleep()
   * const { score } = sleep.getInfo()
   * const sleepStageConstants = sleep.getStageConstantObj()
   * const stage = sleep.getStage()
   *
   * stage.forEach((i) => {
   *   const { model } = i
   *
   *   if (model === sleepStageConstants.WAKE_STAGE) {
   *     console.log('This stage is awake stage')
   *   }
   * })
   * ```
   */
  class Sleep {
    /**
     * @en By default, the system updates the sleep data every `30` minutes, the `updateInfo` method is used to actively trigger the update of the sleep data
     * @zh 系统默认每 `30` 分钟更新一次睡眠数据,`updateInfo` 方法用来主动触发更新睡眠数据
     */
    updateInfo(): void
    /**
     * @en Get sleep information
     * @zh 获取睡眠信息
     */
    getInfo(): Sleep.getInfo.SleepInfo
    /**
     * @en Get the constant value of the sleep stage, used to determine the sleep stage in the `getStage` return value
     * @zh 获取睡眠阶段的常量值，用于在 `getStage` 返回值中判断睡眠阶段
     */
    getStageConstantObj(): Sleep.getStageConstantObj.StageConstants
    /**
     * @en Get Sleep Staging Data
     * @zh 获取睡眠分阶段数据
     */
    getStage(): Array<Sleep.getStage.StageInfo>
    /**
     * @en Get the current sleep state, 0 'awake, 1' sleeping
     * @zh 获取当前睡眠状态，`0` 醒着，`1` 正在睡眠
     * @version 3.0
     */
    getSleepingStatus(): number
    /**
     * @en Get nap data
     * @zh 获取零星小睡数据
     * @version 3.0
     */
    getNap(): Array<Sleep.getNap.NapInfo>
  }
  namespace Weather {
    namespace getForecastWeather {
      /**
       * @output
       */
      interface ForecastWeather {
        /**
         * @en City Name
         * @zh 城市名称
         */
        cityName: string
        /**
         * @en Weather Information
         * @zh 天气信息
         */
        forecastData: ForecastData
        /**
         * @en Tide Information
         * @zh 潮汐信息
         */
        tideData: TideData
      }

      /**
       * @output
       */
      interface ForecastData {
        /**
         * @en Weather Information Array, index 0 position represents the day
         * @zh 天气信息数组，索引 0 位置代表当天
         */
        data: Array<ForecastDataItem>
        /**
         * @en The length of Weather Information Array
         * @zh 天气信息数组长度
         */
        count: number
      }

      /**
       * @output
       */
      interface ForecastDataItem {
        /**
         * @en Maximum temperature
         * @zh 最高温度
         */
        high: number
        /**
         * @en Lowest temperature
         * @zh 最低温度
         */
        low: number
        /**
         * @en The index value of the weather, see `index` below for a description of the value
         * @zh 天气的索引值，值描述详见下方 `index`
         */
        index: number
      }

      /**
       * @output
       * @enum
       */
      interface index {
        /**
         * @en Cloudy
         * @zh 多云
         */
        0: number
        /**
         * @en Showers
         * @zh 阵雨
         */
        1: number
        /**
         * @en Snow Showers
         * @zh 阵雪
         */
        2: number
        /**
         * @en Sunny
         * @zh 晴
         */
        3: number
        /**
         * @en Overcast
         * @zh 阴
         */
        4: number
        /**
         * @en Light Rain
         * @zh 小雨
         */
        5: number
        /**
         * @en Light Snow
         * @zh 小雪
         */
        6: number
        /**
         * @en Moderate Rain
         * @zh 中雨
         */
        7: number
        /**
         * @en Moderate Snow
         * @zh 中雪
         */
        8: number
        /**
         * @en Heavy Snow
         * @zh 大雪
         */
        9: number
        /**
         * @en Heavy Rain
         * @zh 大雨
         */
        10: number
        /**
         * @en Sandstorm
         * @zh 沙尘暴
         */
        11: number
        /**
         * @en Rain and Snow
         * @zh 雨夹雪
         */
        12: number
        /**
         * @en Fog
         * @zh 雾
         */
        13: number
        /**
         * @en Hazy
         * @zh 霾
         */
        14: number
        /**
         * @en T-Storms
         * @zh 雷阵雨
         */
        15: number
        /**
         * @en Snowstorm
         * @zh 暴雪
         */
        16: number
        /**
         * @en Floating dust
         * @zh 浮尘
         */
        17: number
        /**
         * @en Very Heavy Rainstorm
         * @zh 特大暴雨
         */
        18: number
        /**
         * @en Rain and Hail
         * @zh 雨加冰雹
         */
        19: number
        /**
         * @en T-Storms and Hail
         * @zh 雷阵雨伴有冰雹
         */
        20: number
        /**
         * @en Heavy Rainstorm
         * @zh 大暴雨
         */
        21: number
        /**
         * @en Dust
         * @zh 扬尘
         */
        22: number
        /**
         * @en Heavy sand storm
         * @zh 强沙尘暴
         */
        23: number
        /**
         * @en Rainstorm
         * @zh 暴雨
         */
        24: number
        /**
         * @en Unknown
         * @zh 未知天气
         */
        25: number
        /**
         * @en Cloudy Nighttime
         * @zh 夜间多云
         */
        26: number
        /**
         * @en Showers Nighttime
         * @zh 夜间阵雨
         */
        27: number
        /**
         * @en Sunny Nighttime
         * @zh 夜间晴
         */
        28: number
      }

      /**
       * @output
       */
      interface TideData {
        /**
         * @en Tide Information Array, index 0 position represents the day
         * @zh 潮汐信息数组，索引 0 位置代表当天
         */
        data: Array<TideDataItem>
        /**
         * @en The length of Tide Information Array
         * @zh 潮汐信息数组长度
         */
        count: number
      }

      /**
       * @output
       */
      interface TideDataItem {
        /**
         * @en Sunrise time
         * @zh 日出时间
         */
        sunrise: Sunrise
        /**
         * @en Sunset time
         * @zh 日落时间
         */
        sunset: Sunset
      }

      /**
       * @output
       */
      interface Sunrise {
        /**
         * @en Sunrise time - hour
         * @zh 日出时间 - 小时
         */
        hour: number
        /**
         * @en Sunrise time - minute
         * @zh 日出时间 - 分钟
         */
        minute: number
      }

      /**
       * @output
       */
      interface Sunset {
        /**
         * @en Sunrise time - hour
         * @zh 日落时间 - 小时
         */
        hour: number
        /**
         * @en Sunrise time - minute
         * @zh 日落时间 - 分钟
         */
        minute: number
      }
    }
  }

  /**
   * @en Weather Forecasts sensor
   * @zh 天气预报传感器
   * @deprecated https://github.com/orgs/zepp-health/discussions/83
   * @example
   * ```js
   * import { Weather } from '@zos/sensor'
   *
   * const weather = new Weather()
   * const { forecastData, tideData, cityName } = weather.getForecast()
   *
   * console.log(cityName)
   *
   * for (let i = 0; i < forecastData.count; i++) {
   *   const element = forecastData.data[i]
   *   console.log('Index' + element.index)
   *   console.log('Highest temperature' + element.high)
   *   console.log('Lowest temperature' + element.low)
   * }
   *
   * for (let i = 0; i < tideData.count; i++) {
   *   const element = tideData.data[i]
   *   console.log('Sunrise' + element.sunrise.hour + element.sunrise.minute)
   *   console.log('Sunset' + element.sunset.hour + element.sunset.minute)
   * }
   * ```
   */
  class Weather {
    /**
     * @en Get weather forecast data
     * @zh 获取天气预报数据
     */
    getForecastWeather(): Weather.getForecastWeather.ForecastWeather
  }
  namespace Vibrator {
    namespace start {
      interface Option {
        /**
         * @en Vibration mode, Value refer to Vibration motor mode constants
         * @zh 振动模式，值参考振动马达模式常量
         * @defaultValue VIBRATOR_SCENE_SHORT_MIDDLE
         */
        mode?: number
      }

      interface Action {
        /**
         * @en Vibration Scene Type
         * @zh 震动场景类型
         * @version 3.6
         */
        type: number
        /**
         * @en Duration of vibration
         * @zh 震动持续时长
         * @version 3.6
         */
        duration?: number
      }
    }

    namespace setMode {
      interface Option {
        /**
         * @en Vibration mode, Value refer to Vibration motor mode constants
         * @zh 振动模式，值参考振动马达模式常量
         */
        mode: number
      }
    }

    namespace getConfig {
      /**
       * @output
       */
      interface Option {
        /**
         * @en Vibration mode, Value refer to Vibration motor mode constants
         * @zh 振动模式，值参考振动马达模式常量
         */
        mode: number
      }
    }

    namespace getType {
      /**
       * @output
       */
      interface Type {
        /**
         * @en Vibration scene, light short vibration
         * @zh 震动场景，轻短振
         */
        GENTLE_SHORT: number
        /**
         * @en Vibration scene, strong and short vibration
         * @zh 震动场景，强短振
         */
        STRONG_SHORT: number
        /**
         * @en Vibration scene, standard crown vibration
         * @zh 震动场景，标准表冠振动
         */
        STANDARD_CROWN: number
        /**
         * @en Vibration scene, strong crown vibration
         * @zh 震动场景，强表冠振动
         */
        STRONG_CROWN: number
        /**
         * @en Vibration scene, single-pulse crown vibration
         * @zh 震动场景，单脉冲表冠振动
         */
        SPULSE_CROWN: number
        /**
         * @en Vibration scene, dual-pulse crown vibration
         * @zh 震动场景，双脉冲表冠振动
         */
        DIPULSE_CROWN: number
        /**
         * @en Vibration scene, password button vibration
         * @zh 震动场景，密码按键振动
         */
        KEYCODE_CLICK: number
        /**
         * @en Vibration scene, urgent vibration
         * @zh 震动场景，加急振动
         */
        URGENT: number
        /**
         * @en Vibration scene, continuous vibration
         * @zh 震动场景，持续振动
         */
        CONTINUOUS: number
        /**
         * @en Vibration scene, stop vibration
         * @zh 震动场景，停止振动
         */
        PAUSE: number
      }
    }
  }

  /**
   * @en Vibrator
   * @zh 振动马达
   * @example
   * ```js
   * import { Vibrator, VIBRATOR_SCENE_DURATION } from '@zos/sensor'
   *
   * const vibrator = new Vibrator()
   * vibrator.start()
   *
   * // set scene
   * vibrator.setMode(VIBRATOR_SCENE_DURATION)
   * vibrator.start()
   * ```
   */
  class Vibrator {
    /**
     * @en Start vibration, the'option 'parameter passed in only takes effect for this vibration, and supports passing in vibration scene arrays after API_LEVEL 3.6
     * @zh 开始振动，传入的 `option` 参数，只对此次振动生效，在 API_LEVEL 3.6 后支持传入震动场景数组
     * @constants vibrator_scene
     */
    start(option?: Vibrator.start.Option | Array<Vibrator.start.Action>): void
    /**
     * @en Stop vibration
     * @zh 停止振动
     */
    stop(): void
    /**
     * @en Set the vibration mode, call `start()` after successful setting, it will vibrate according to the set mode
     * @zh 设置振动模式，设置成功后调用 `start()`，会依照设置的模式进行振动
     */
    setMode(option: Vibrator.setMode.Option): void
    /**
     * @en Get Vibration Motor Configuration
     * @zh 获取振动马达配置
     */
    getConfig(): Vibrator.getConfig.Option
    /**
     * @en Get Vibration Scene Type
     * @zh 获取振动场景类型
     * @version 3.6
     */
    getType(): Vibrator.getType.Type
  }
  /**
   * @en Barometer Sensor
   * @zh 气压高度传感器
   * @permissionCode device:os.barometer
   * @version 2.1
   * @example
   * ```js
   * import { Barometer } from '@zos/sensor'
   *
   * const barometer = new Barometer()
   * const airPressure = barometer.getAirPressure()
   * const altitude = barometer.getAltitude()
   *
   * const callback = () => {
   *   console.log(barometer.getAltitude())
   * }
   *
   * barometer.onChange(callback)
   *
   * // When not needed for use
   * barometer.offChange(callback)
   * ```
   */
  class Barometer {
    /**
     * @en Get air pressure value in hPa
     * @zh 获取气压值，单位百帕
     */
    getAirPressure(): number
    /**
     * @en Get altitude value in meters
     * @zh 获取海拔高度值，单位米
     */
    getAltitude(): number
    /**
     * @en Register the air pressure and altitude change event callback function
     * @zh 注册气压和海拔变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the air pressure and altitude change event callback function
     * @zh 取消气压和海拔变化事件监听回调函数
     */
    offChange(callback: () => void): void
  }
  namespace Geolocation {
    namespace getLatitude {
      interface Option {
        /**
         * @en Coordinate format, optionally `DD` for decimal or `DMS` in degrees, minutes and seconds
         * @zh 坐标格式，可选 `DD` 代表十进制或者 `DMS` 度分秒的形式
         * @defaultValue DD
         */
        format?: string
      }

      /**
       * @en Coordinates, coordinate system type WGS-84
       * @zh 坐标，坐标系类型 WGS-84
       */
      type Result = number | DMS

      /**
       * @output
       */
      interface DMS {
        /**
         * @en Direction, `N` for north latitude, `S` for south latitude
         * @zh 方向，`N` 代表北纬，`S` 代表南纬
         */
        direction: string
        /**
         * @en degree
         * @zh 度
         */
        degrees: number
        /**
         * @en minute
         * @zh 分
         */
        minutes: number
        /**
         * @en second
         * @zh 秒
         */
        seconds: number
      }
    }

    namespace getLongitude {
      interface Option {
        /**
         * @en Coordinate format, optionally `DD` for decimal or `DMS` in degrees, minutes and seconds
         * @zh 坐标格式，可选 `DD` 代表十进制或者 `DMS` 度分秒的形式
         * @defaultValue DD
         */
        format?: string
      }

      /**
       * @en Coordinates, coordinate system type WGS-84
       * @zh 坐标，坐标系类型 WGS-84
       */
      type Result = number | DMS

      /**
       * @output
       */
      interface DMS {
        /**
         * @en Direction, `E` for east longitude, `W` for west longitude
         * @zh 方向，`E` 代表东经，`W` 代表西经
         */
        direction: string
        /**
         * @en degree
         * @zh 度
         */
        degrees: number
        /**
         * @en minute
         * @zh 分
         */
        minutes: number
        /**
         * @en second
         * @zh 秒
         */
        seconds: number
      }
    }

    namespace getSetting {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Positioning settings, see `mode` below for value descriptions
         * @zh 定位设置，值描述详见下方 `mode`
         */
        mode: number
      }

      /**
       * @output
       * @enum
       */
      interface mode {
        /**
         * @en Accuracy
         * @zh 精准模式
         */
        0: number
        /**
         * @en Automation
         * @zh 智能模式
         */
        1: number
        /**
         * @en Balance
         * @zh 均衡模式
         */
        2: number
        /**
         * @en Power Saving
         * @zh 省电模式
         */
        3: number
        /**
         * @en Super Power Saving
         * @zh 超级省电模式
         */
        4: number
        /**
         * @en Custom
         * @zh 自定义模式
         */
        5: number
      }
    }

    namespace onGnssChange {
      /**
       * @output
       */
      interface Info {
        /**
         * @en AGPS update time UTC timestamp in milliseconds
         * @zh AGPS 更新时间 UTC 时间戳，单位毫秒
         */
        agps_inject_time: number
        /**
         * @en Signal strength value of the positioning satellite
         * @zh 定位卫星的信号强度值
         */
        top4_cn_val: number
        /**
         * @en Whether dual-band
         * @zh 是否双频
         */
        is_dualband: number
        /**
         * @en Number of available satellites
         * @zh 可用卫星数量
         */
        nb_valid_satellite: number
        /**
         * @en Number of satellites used
         * @zh 使用的卫星数量
         */
        nb_used_satellite: number
        /**
         * @en Time consumed from the start of satellite search to successful positioning, in seconds
         * @zh 从搜索卫星开始到定位成功所消耗的时间，单位秒
         */
        elapsed_time: number
        /**
         * @en Satellite data arrays
         * @zh 卫星数据数组
         */
        satellite_data: Array<SatelliteSystem>
      }

      /**
       * @output
       */
      interface SatelliteSystem {
        /**
         * @en Satellite ID, see `gnss_id` below for value descriptions
         * @zh 卫星系统 ID，值描述见下方 `gnss_id`
         */
        gnss_id: number
        /**
         * @en The strongest signal value of this satellite system
         * @zh 该卫星系统的最强信号值
         */
        sub_top4_cn_val: number
        /**
         * @en Number of available satellites that can be searched
         * @zh 搜索到可用卫星数量
         */
        nb_valid_satellite: number
        /**
         * @en Single satellite data array, maximum length 32
         * @zh 单颗卫星数据数组，最大长度 32
         * @version 3.6
         */
        gsv_data: Array<Satellite>
      }

      /**
       * @output
       * @enum
       */
      interface gnss_id {
        /**
         * @en GPS
         * @zh GPS 全球定位系统
         */
        0: number
        /**
         * @en BDS
         * @zh BDS 北斗卫星导航系统
         */
        1: number
        /**
         * @en GLONASS
         * @zh GLONASS 全球导航卫星系统
         */
        2: number
        /**
         * @en GALILEO
         * @zh GALILEO 伽利略定位系统
         */
        3: number
        /**
         * @en QZSS
         * @zh QZSS 准天顶卫星系统
         */
        4: number
        /**
         * @en IRNSS
         * @zh IRNSS 印度区域导航卫星系统
         */
        5: number
      }

      /**
       * @output
       */
      interface Satellite {
        /**
         * @en Satellite ID
         * @zh 卫星 ID
         * @version 3.6
         */
        id: number
        /**
         * @en Pitch angle
         * @zh 俯仰角
         * @version 3.6
         */
        elevation: number
        /**
         * @en Azimuth
         * @zh 方位角
         * @version 3.6
         */
        azimuth: number
        /**
         * @en Signal-to-noise ratio
         * @zh 信噪比
         * @version 3.6
         */
        snr: number
      }
    }
  }

  /**
   * @en Geolocation Sensor
   * @zh 定位传感器
   * @permissionCode device:os.geolocation
   * @version 2.1
   * @example
   * ```js
   * import { Geolocation } from '@zos/sensor'
   *
   * const geolocation = new Geolocation()
   *
   * const callback = () => {
   *   if (geolocation.getStatus() === 'A') {
   *     console.log(geolocation.getLatitude())
   *     console.log(geolocation.getLongitude())
   *   }
   * }
   *
   * geolocation.start()
   * geolocation.onChange(callback)
   *
   * // When not needed for use
   * geolocation.offChange(callback)
   * geolocation.stop()
   * ```
   */
  class Geolocation {
    /**
     * @en Start listening to location data
     * @zh 开始监听定位数据
     */
    start(): void
    /**
     * @en Stop listening to location data
     * @zh 停止监听定位数据
     */
    stop(): void
    /**
     * @en Get the positioning status, return `A` for positioning in progress, return `V` for invalid positioning
     * @zh 获取定位状态，返回 `A` 代表定位中，返回 `V` 代表无效定位
     */
    getStatus(): string
    /**
     * @en Get Latitude
     * @zh 获取纬度
     */
    getLatitude(option: Geolocation.getLatitude.Option): Geolocation.getLatitude.Result
    /**
     * @en Get Longitude
     * @zh 获取经度
     */
    getLongitude(option: Geolocation.getLongitude.Option): Geolocation.getLongitude.Result
    /**
     * @en Get the positioning settings
     * @zh 获取定位设置
     * @version 3.0
     */
    getSetting(): Geolocation.getSetting.Result
    /**
     * @en Register a callback function to listen for location information change events
     * @zh 注册定位信息变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the callback function for listening to the location information change event
     * @zh 取消定位信息变化事件监听回调函数
     */
    offChange(callback: () => void): void
    /**
     * @en Register a callback function to listen for GNSS information change events
     * @zh 注册 GNSS 信息变化事件监听回调函数
     * @version 3.0
     */
    onGnssChange(callback: (info: Geolocation.onGnssChange.Info) => void): void
    /**
     * @en Cancel the callback function for listening to the GNSS information change event
     * @zh 取消 GNSS 信息变化事件监听回调函数
     * @version 3.0
     */
    offGnssChange(callback: (info: Geolocation.onGnssChange.Info) => void): void
    /**
     * @en Get whether the user allows the Mini Program to use location features
     * @zh 获取用户是否允许小程序使用定位功能
     * @version 4.0
     */
    getEnabled(): boolean
    /**
     * @en Register a callback function to listen for user location permission change events
     * @zh 注册用户定位授权状态变化事件监听回调函数
     * @version 4.0
     */
    onEnableChange(callback: () => void): void
    /**
     * @en Cancel the callback function for listening to user location permission change events
     * @zh 取消用户定位授权状态变化事件监听回调函数
     * @version 4.0
     */
    offEnableChange(callback: () => void): void
  }
  namespace Workout {
    namespace getStatus {
      /**
       * @output
       */
      interface Status {
        /**
         * @en VO2 Max
         * @zh 最大摄氧量
         */
        vo2Max: number
        /**
         * @en Training Load
         * @zh 运动负荷
         */
        trainingLoad: number
        /**
         * @en Full Recovery Time
         * @zh 完全恢复时间
         */
        fullRecoveryTime: number
      }
    }

    namespace getHistory {
      /**
       * @output
       */
      interface History {
        /**
         * @en Workout start time
         * @zh 运动开始时间
         */
        startTime: number
        /**
         * @en Duration of workout in seconds
         * @zh 时长，单位秒
         */
        duration: number
      }
    }

    namespace getUserHrZoneSettings {
      /**
       * @output
       */
      interface HrZoneSettings {
        /**
         * @en Heart rate zone type, 0: by heart rate reserve, 1: by maximum heart rate
         * @zh 心率区间类型，0: 按储备心率，1: 按最大心率
         */
        type: number
        /**
         * @en Resting heart rate value
         * @zh 静息心率值
         */
        rest: number
        /**
         * @en Heart rate zone value array with 6 values, corresponding to: Ligit, Intensive, Aerobic, Anaerobic, VO2 max and maximum heart rate
         * @zh 心率区间值数组，含 6 个数值，依次对应：热身放松、脂肪燃烧、心肺强化、耐力强化、无氧极限和最大心率
         */
        range: number[]
      }
    }

    namespace getWorkoutTrackNavInfo {
      /**
       * @output
       */
      interface WorkoutTrackNavInfo {
        /**
         * @en Data update status, true: need update, false: no need to update
         * @zh 数据更新状态，true: 需更新，false: 无需更新
         */
        update: number
        /**
         * @en Whether off course, true: off course, false: on course
         * @zh 是否偏航，true: 偏航，false: 未偏航
         */
        isYaw: number
        /**
         * @en Yaw angle
         * @zh 偏航夹角
         */
        yawAngle: number
        /**
         * @en Yaw distance in meters
         * @zh 偏航距离（米）
         */
        yawDistance: number
        /**
         * @en Remaining distance in meters
         * @zh 剩余距离（米）
         */
        remainDistance: number
        /**
         * @en Distance to next turn in meters
         * @zh 到下一个转弯的距离（米）
         */
        turnDistance: number
        /**
         * @en The direction of the next turn, refer to `TURN_TYPE` for value meanings
         * @zh 下一个转弯的方向，值含义参考 `TURN_TYPE`
         */
        turnType: number
      }

      /**
       * @output
       * @enum
       */
      interface TURN_TYPE {
        /**
         * @en Turn right forward
         * @zh 右前转
         */
        1: number
        /**
         * @en Turn right
         * @zh 右转
         */
        2: number
        /**
         * @en Turn right backward
         * @zh 右后转
         */
        3: number
        /**
         * @en U-turn to the right
         * @zh 向右掉头
         */
        4: number
        /**
         * @en U-turn
         * @zh 掉头
         */
        5: number
        /**
         * @en U-turn to the left
         * @zh 向左掉头
         */
        6: number
        /**
         * @en Turn left backward
         * @zh 左后转
         */
        7: number
        /**
         * @en Turn left
         * @zh 左转
         */
        8: number
        /**
         * @en Turn left forward
         * @zh 左前转
         */
        9: number
      }
    }
  }

  /**
   * @en Workout Sensor
   * @zh 运动传感器
   * @permissionCode data:user.hd.workout
   * @version 3.0
   * @example
   * ```js
   * import { Workout } from '@zos/sensor'
   *
   * const workout = new Workout()
   *
   * const status = workout.getStatus()
   * const history = workout.getHistory()
   *
   * const hrZoneSettings = workout.getUserHrZoneSettings()
   * // {"type":0,"rest":83,"range":[129,138,147,157,166,175]}
   * // {"type":1,"rest":70,"range":[90,108,126,144,162,181]}
   *
   * const trackNavInfo = workout.getWorkoutTrackNavInfo()
   *
   * ```
   */
  class Workout {
    /**
     * @en Get altitude value in meters
     * @zh 获取运动状态
     */
    getStatus(): Workout.getStatus.Status
    /**
     * @en Get the duration of the workout record
     * @zh 获取运动记录时长
     */
    getHistory(): Array<Workout.getHistory.History>
    /**
     * @en Get user heart rate zone settings
     * @zh 获取用户运动心率区间设置
     * @version 4.2
     */
    getUserHrZoneSettings(): Workout.getUserHrZoneSettings.HrZoneSettings
    /**
     * @en Get workout track navigation information, returns navigation info object when navigation is enabled, returns `undefined` when navigation is not enabled
     * @zh 获取运动中轨迹导航信息，开启导航时返回导航信息对象，未开启导航时返回 `undefined`
     * @version 4.2
     */
    getWorkoutTrackNavInfo(): Workout.getWorkoutTrackNavInfo.WorkoutTrackNavInfo | undefined
  }
  namespace WorldClock {
    namespace getInfo {
      /**
       * @output
       */
      interface WorldClockInfo {
        /**
         * @en City Name
         * @zh 城市名
         */
        city: string
        /**
         * @en City code, e.g. San Francisco `SFO`
         * @zh 城市代号，如旧金山 `SFO`
         */
        cityCode: string
        /**
         * @en Hour
         * @zh 小时
         */
        hour: number
        /**
         * @en Minute
         * @zh 分钟
         */
        minute: number
        /**
         * @en Time Zone hours
         * @zh 时区小时
         */
        timeZoneHour: number
        /**
         * @en Time zone minutes
         * @zh 时区分钟
         */
        timeZoneMinute: number
      }
    }
  }

  /**
   * @en World Clock Sensor
   * @zh 世界时钟传感器
   * @version 3.0
   * @example
   * ```js
   * import { WorldClock } from '@zos/sensor'
   *
   * const worldClock = new WorldClock()
   * const worldClockCount = worldClock.getCount()
   *
   * for (let i = 0; i < worldClockCount; i++) {
   *   const worldClockInfo = worldClock.getInfo(i)
   *   console.log(worldClockInfo.city)
   *   console.log(worldClockInfo.cityCode)
   *   console.log(worldClockInfo.hour)
   *   console.log(worldClockInfo.minute)
   *   console.log(worldClockInfo.timeZoneHour)
   *   console.log(worldClockInfo.timeZoneMinute)
   * }
   *
   * // When not needed for use
   * worldClock.destroy()
   * ```
   */
  class WorldClock {
    /**
     * @en Get the number of configured world clocks
     * @zh 获取配置的世界时钟数量
     */
    getCount(): number
    /**
     * @en Get the configured world clock information according to the index
     * @zh 根据索引获取配置的世界时钟信息
     */
    getInfo(index: number): WorldClock.getInfo.WorldClockInfo
  }
  namespace Compass {
    namespace getDirection {
      /**
       * @output
       * @enum
       */
      interface direction {
        /**
         * @en North
         * @zh 北
         */
        N: string
        /**
         * @en Northeast
         * @zh 东北
         */
        NE: string
        /**
         * @en East
         * @zh 东
         */
        E: string
        /**
         * @en Southeast
         * @zh 东南
         */
        SE: string
        /**
         * @en South
         * @zh 南
         */
        S: string
        /**
         * @en Southwest
         * @zh 西南
         */
        SW: string
        /**
         * @en West
         * @zh 西
         */
        W: string
        /**
         * @en Northwest
         * @zh 西北
         */
        NW: string
      }
    }
  }

  /**
   * @en compass
   * @zh 指南针
   * @permissionCode device:os.compass
   * @version 3.0
   * @example
   * ```js
   * import { Compass } from '@zos/sensor'
   *
   * const compass = new Compass()
   *
   * const callback = () => {
   *   if (compass.getStatus()) {
   *     console.log(compass.getDirection())
   *     console.log(compass.getDirectionAngle())
   *   }
   * }
   * compass.onChange(callback)
   * compass.start()
   *
   * // When not needed for use
   * compass.offChange()
   * compass.stop()
   * ```
   */
  class Compass {
    /**
     * @en Start listening to compass data
     * @zh 开始监听指南针数据
     */
    start(): void
    /**
     * @en Stop listening to compass data
     * @zh 停止监听指南针数据
     */
    stop(): void
    /**
     * @en Get the compass calibration status, `true` means calibrated
     * @zh 获取指南针校准状态，`true` 代表已校准
     */
    getStatus(): boolean
    /**
     * @en Get the direction of the current watch's 12-point scale, divided into eight directions, refer to `direction`
     * @zh 获取当前手表 12 点刻度的方向指向，一共分为八个方向，参考 `direction`
     */
    getDirection(): string
    /**
     * @en Get the current direction angle, the clockwise rotation angle of the watch's 12 o'clock scale direction relative to due north, takes the values 0 - 360, if the compass is not calibrated, returns the `INVALID` string
     * @zh 获取当前方向角，手表 12 点刻度方向相对正北方向的顺时针旋转角度，取值 0 - 360，如果指南针未校准，返回 `INVALID` 字符串
     */
    getDirectionAngle(): number | 'INVALID'
    /**
     * @en Register the compass direction change event listener callback function
     * @zh 注册指南针方向变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the compass direction change event listener callback function
     * @zh 取消指南针方向变化事件监听回调函数
     */
    offChange(callback: () => void): void
    /**
     * @en Set the mode of trigger frequency, `mode` value reference frequency mode constant
     * @zh 设置触发频率的模式，`mode` 值参考频率模式常量
     * @constants freq_mode
     * @version 4.0
     */
    setFreqMode(mode: number): void
    /**
     * @en Get the mode of trigger frequency, result value reference frequency mode constant
     * @zh 获取触发频率模式，结果值参考频率模式常量
     * @constants freq_mode
     * @version 4.0
     */
    getFreqMode(): number
  }
  namespace Gyroscope {
    namespace getCurrent {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Angular velocity of x-axis in DPS, degrees per second
         * @zh x 轴的角速度，单位 DPS，度数/秒
         */
        x: number
        /**
         * @en Angular velocity of y-axis in DPS, degrees per second
         * @zh y 轴的角速度，单位 DPS，度数/秒
         */
        y: number
        /**
         * @en Angular velocity of z-axis in DPS, degrees per second
         * @zh z 轴的角速度，单位 DPS，度数/秒
         */
        z: number
      }
    }
  }

  /**
   * @en Gyroscope. Measuring the angular velocity of the device rotating along three orthogonal axes (x, y, z), the x and y axes are parallel to the screen, the positive direction refers to the figure, the z axis is perpendicular to the device's screen, the positive direction points upward, and the direction of the rotational angular velocity is determined using the [Right-hand rule](https://en.wikipedia.org/wiki/Right-hand_rule). The direction of the rotation arrow in the figure is the positive direction
   * @zh 陀螺仪。测量设备沿三个正交轴（x,y,z）旋转的角速度，x、y 轴与屏幕平行，正方向参考图示，z 轴垂直于设备的屏幕，正方向指向上方，旋转角速度的方向使用[右手定则](https://en.wikipedia.org/wiki/Right-hand_rule)来确定，图示旋转箭头方向为正方向
   * @permissionCode device:os.gyroscope
   * @version 3.0
   * @img https://img-cdn.zepp.com/20231219/4ede3747e830cb5adf0cfaa79ba59e0a.jpeg
   * @example
   * ```js
   * import { Gyroscope, FREQ_MODE_LOW } from '@zos/sensor'
   *
   * const gyroscope = new Gyroscope()
   *
   * const callback = () => {
   *   console.log(gyroscope.getCurrent())
   * }
   * gyroscope.onChange(callback)
   * gyroscope.setFreqMode(FREQ_MODE_LOW)
   * gyroscope.start()
   *
   * // When not needed for use
   * gyroscope.offChange()
   * gyroscope.stop()
   * ```
   */
  class Gyroscope {
    /**
     * @en Start listening to gyroscope data
     * @zh 开始监听陀螺仪数据
     */
    start(): void
    /**
     * @en Stop listening to gyroscope data
     * @zh 停止监听陀螺仪数据
     */
    stop(): void
    /**
     * @en Get current gyroscope data
     * @zh 获取当前陀螺仪数据
     */
    getCurrent(): Gyroscope.getCurrent.Result
    /**
     * @en Register the gyroscope data change event listener callback function
     * @zh 注册陀螺仪数据变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the gyroscope data change event listener callback function
     * @zh 取消陀螺仪数据变化事件监听回调函数
     */
    offChange(callback: () => void): void
    /**
     * @en Set the mode of trigger frequency, `mode` value reference frequency mode constant
     * @zh 设置触发频率的模式，`mode` 值参考频率模式常量
     * @constants freq_mode
     * @version 3.0
     */
    setFreqMode(mode: number): void
    /**
     * @en Get the mode of trigger frequency, result value reference frequency mode constant
     * @zh 获取触发频率模式，结果值参考频率模式常量
     * @constants freq_mode
     * @version 3.0
     */
    getFreqMode(): number
  }
  namespace Accelerometer {
    namespace getCurrent {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Acceleration of x-axis in cm/s^2
         * @zh x 轴的加速度，单位 cm/s^2
         */
        x: number
        /**
         * @en Acceleration of y-axis in cm/s^2
         * @zh y 轴的加速度，单位 cm/s^2
         */
        y: number
        /**
         * @en Acceleration of z-axis in cm/s^2
         * @zh z 轴的加速度，单位 cm/s^2
         */
        z: number
      }
    }
  }

  /**
   * @en accelerometer. Measure the acceleration of the device along three orthogonal axes (x, y, z). The x and y axes are parallel to the screen, with the positive direction referring to the diagram. The z-axis is perpendicular to the device's screen, with the positive direction pointing upward
   * @zh 加速度传感器。沿三个正交轴（x,y,z）测量设备的加速度，x、y 轴与屏幕平行，正方向参考图示，z 轴垂直于设备的屏幕，正方向指向上方
   * @img https://img-cdn.zepp.com/20231219/04be57a185e1632a0467ea8d094f55da.jpeg
   * @permissionCode device:os.accelerometer
   * @version 3.0
   * @example
   * ```js
   * import { Accelerometer, FREQ_MODE_NORMAL } from '@zos/sensor'
   *
   * const accelerometer = new Accelerometer()
   *
   * const callback = () => {
   *   console.log(accelerometer.getCurrent())
   * }
   * accelerometer.onChange(callback)
   * accelerometer.setFreqMode(FREQ_MODE_NORMAL)
   * accelerometer.start()
   *
   * // When not needed for use
   * accelerometer.offChange()
   * accelerometer.stop()
   * ```
   */
  class Accelerometer {
    /**
     * @en Start listening to accelerometer data
     * @zh 开始监听加速度传感器数据
     */
    start(): void
    /**
     * @en Stop listening to accelerometer data
     * @zh 停止监听加速度传感器数据
     */
    stop(): void
    /**
     * @en Get current accelerometer data
     * @zh 获取当前加速度传感器数据
     */
    getCurrent(): Accelerometer.getCurrent.Result
    /**
     * @en Register the accelerometer data change event listener callback function
     * @zh 注册加速度传感器数据变化事件监听回调函数
     */
    onChange(callback: () => void): void
    /**
     * @en Cancel the accelerometer data change event listener callback function
     * @zh 取消加速度传感器数据变化事件监听回调函数
     */
    offChange(callback: () => void): void
    /**
     * @en Set the mode of trigger frequency, `mode` value reference frequency mode constant
     * @zh 设置触发频率的模式，`mode` 值参考频率模式常量
     * @constants freq_mode
     * @version 3.0
     */
    setFreqMode(mode: number): void
    /**
     * @en Get the mode of trigger frequency, result value reference frequency mode constant
     * @zh 获取触发频率模式，结果值参考频率模式常量
     * @constants freq_mode
     * @version 3.0
     */
    getFreqMode(): number
  }
  /**
   * @en Screen Status Sensor
   * @zh 屏幕状态传感器
   * @version 3.0
   * @example
   * ```js
   * import { Screen } from '@zos/sensor'
   *
   * const screen = new Screen()
   * const status = screen.getStatus()
   * const callback = () => {
   *   console.log(screen.getStatus())
   * }
   *
   * screen.onChange(callback)
   *
   * // When not needed for use
   * screen.offChange(callback)
   * ```
   */
  class Screen {
    /**
     * @en Get the screen status, `1`: On, `2`: Off
     * @zh 获取屏幕状态，`1`: 亮屏、`2`: 息屏
     */
    getStatus(): number
    /**
     * @en Whether to turn on the AOD rest screen display function
     * @zh 是否开启 AOD 息屏显示功能
     */
    getAodMode(): boolean
    /**
     * @en Light intensity, unit lux
     * @zh 光照强度，单位 lux
     * @version 3.6
     */
    getLight(): number
    /**
     * @en Register a callback function to listen to screen display change events
     * @zh 注册屏幕显示变化事件监听回调函数
     */
    onChange(callback: (status: number) => void): void
    /**
     * @en Cancel a callback function to listen to screen display change events
     * @zh 取消屏幕显示变化事件监听回调函数
     */
    offChange(callback: (status: number) => void): void
  }
  namespace BodyTemperature {
    namespace getCurrent {
      /**
       * @output
       */
      interface Result {
        /**
         * @en Sleep stage type, refer to the constants returned by `getStageConstantObj` for the meaning of the value
         * @zh 温度测量值
         */
        current: number
        /**
         * @en Sleep stage type, refer to the constants returned by `getStageConstantObj` for the meaning of the value
         * @zh 上次测量时间
         */
        time: number
      }
    }
  }

  /**
   * @en Body surface temperature sensor
   * @zh 体表温度传感器
   * @permissionCode data:user.hd.body_temp
   * @version 3.0
   * @example
   * ```js
   * import { BodyTemperature } from '@zos/sensor'
   *
   * const bodyTemperature = new BodyTemperature()
   *
   * bodyTemperature.getCurrent()
   * ```
   */
  class BodyTemperature {
    /**
     * @en Get the latest measurement of body surface temperature
     * @zh 获取最近一次体表温度的测量值
     */
    getCurrent(): BodyTemperature.getCurrent.Result
    /**
     * @en Get the body surface temperature measurement values for 24 hours a day. The array length is 24 * 60 / 5 = 288, with an average measurement value every five minutes. The unit is Celsius, such as `35.2`. Data without measurement values is `-1000`
     * @zh 获取全天 24 小时的体表温度测量值，数组长度为 24 * 60 / 5 = 288，每五分钟一个的平均测量值，单位摄氏度，如 `35.2`，无测量值的数据为 `-1000`
     */
    getToday(): Array<number>
  }
  namespace SystemSounds {
    namespace getSourceType {
      interface Type {
        /**
         * @en Alarm clock reminder
         * @zh 闹钟提醒
         */
        ALARM: number
        /**
         * @en Notification sound when receiving text messages or emails
         * @zh 收到短信、邮件时，消息通知声
         */
        MESSAGE: number
        /**
         * @en TingTing sound
         * @zh TingTing 声
         */
        REGULAR: number
        /**
         * @en Goals achieved
         * @zh 目标达成
         */
        ACHIEVE: number
        /**
         * @en Camera shutter
         * @zh 照相机快门
         */
        CAMERA: number
        /**
         * @en Health data measurement abnormalities (high values)
         * @zh 健康数据测量异常（高值）情况
         */
        ABN_HIGH: number
        /**
         * @en Health data measurement abnormalities (low values)
         * @zh 健康数据测量异常（低值）情况
         */
        ABN_LOW: number
        /**
         * @en SOS for help
         * @zh SOS 求救
         */
        SOS: number
      }
    }
  }

  /**
   * @en System Sounds
   * @zh 系统声音
   * @version 3.6
   * @example
   * ```js
   * import { SystemSounds } from '@zos/sensor'
   *
   * const systemSounds = new SystemSounds()
   * const alarmType = systemSounds.getSourceType().ALARM
   *
   * if (systemSounds.getEnabled()) {
   *   systemSounds.start(alarmType)
   * }
   * ```
   */
  class SystemSounds {
    /**
     * @en Get whether the system ringtone function is turned on, and it can only be played after it is turned on
     * @zh 获取系统铃声功能是否开启，开启后才可以播放
     */
    getEnabled(): boolean
    /**
     * @en Get built-in system ringtone type
     * @zh 获取内置系统铃声类型
     */
    getSourceType(): SystemSounds.getSourceType.Type
    /**
     * @en Start playing the sound, you can pass in `type` to specify the ringtone type, `repeatCount` is the number of audio repetitions, default is `0`, do not repeat playback
     * @zh 开始播放声音，可以传入 `type` 指定铃声类型，`repeatCount` 为音频重复次数，默认 `0`，不重复播放
     */
    start(sourceType: number, repeatCount: 0): void
    /**
     * @en Stop sound playback
     * @zh 停止声音播放
     */
    stop(): void
  }
  namespace Buzzer {
    namespace getSourceType {
      /**
       * @output
       * @enum
       */
      interface Type {
        /**
         * @en Alarm clock
         * @zh 闹钟
         */
        ALARM: number
        /**
         * @en Reminder 1
         * @zh 提醒 1
         */
        REMIND_1: number
        /**
         * @en Reminder 2
         * @zh 提醒 2
         */
        REMIND_2: number
        /**
         * @en Operation
         * @zh 操作
         */
        OPERATE: number
        /**
         * @en Success
         * @zh 成功
         */
        SUCCESS: number
        /**
         * @en Failure
         * @zh 失败
         */
        FAILURE: number
      }
    }
  }

  /**
   * @en Buzzer
   * @zh 蜂鸣器
   * @version 3.6
   * @example
   * ```js
   * import { createWidget, widget, prop, align, text_style } from "@zos/ui";
   * import { Buzzer } from "@zos/sensor";
   * import { px } from "@zos/utils";
   *
   * const sceneList = ['ALARM', 'REMIND_1', 'REMIND_2', 'OPERATE', 'SUCCESS', 'FAILURE']
   *
   * Page({
   *   state: {
   *     pageName: "BUZZER",
   *     currentIndex: 0
   *   },
   *   build() {
   *     const buzzer = new Buzzer();
   *     const sceneText = createWidget(widget.TEXT, {
   *       x: px(0),
   *       y: px(120),
   *       w: px(480),
   *       h: px(46),
   *       color: 0xffffff,
   *       text_size: px(20),
   *       align_h: align.CENTER_H,
   *       align_v: align.CENTER_V,
   *       text_style: text_style.NONE,
   *       text: `${sceneList[this.state.currentIndex]}`,
   *     });
   *
   *     const startBuzzer = () => {
   *       const alarmType = buzzer.getSourceType()[sceneList[this.state.currentIndex]];
   *
   *       if (buzzer.isEnabled()) {
   *         buzzer.start(alarmType);
   *       }
   *
   *       this.state.currentIndex = (this.state.currentIndex + 1) % sceneList.length
   *       sceneText.setProperty(prop.MORE, {
   *         text: `BUZZER: ${sceneList[this.state.currentIndex]}`,
   *       });
   *     };
   *
   *     createWidget(widget.BUTTON, {
   *       x: px(80),
   *       y: px(300),
   *       w: px(300),
   *       h: px(60),
   *       radius: px(12),
   *       normal_color: 0xfc6950,
   *       press_color: 0xfeb4a8,
   *       text: "START BUZZER",
   *       click_func: startBuzzer,
   *     });
   *   },
   * });
   */
  class Buzzer {
    /**
     * @en Get whether other options in the system buzzer scene settings are turned on, Settings - > Sound & Vibration - > Buzzer Scene - > Other
     * @zh 获取系统蜂鸣器场景设置中的其他选项是否开启，设置 -> 声音与震动 -> 蜂鸣场景 -> 其他
     */
    isEnabled(): boolean
    /**
     * @en Get buzzer mode
     * @zh 获取蜂鸣模式
     */
    getSourceType(): Buzzer.getSourceType.Type
    /**
     * @en Get buzzer strength, '0' - weak, '1' - medium, '2' - high
     * @zh 获取蜂鸣器强度，`0` - weak，`1` - medium，`2` - high
     */
    getStrength(): number
    /**
     * @en Start beeping, you can pass in `type` to specify the built-in beeping mode of the system,`repeatCount` is the number of repetitions, default `0`, do not repeat
     * @zh 开始蜂鸣，可以传入 `type` 指定系统内置蜂鸣模式，`repeatCount` 为重复次数，默认 `0`，不重复
     */
    start(type: number, repeatCount: 0): void
    /**
     * @en Stop buzzer
     * @zh 停止蜂鸣器
     */
    stop(): void
  }
  namespace checkSensor {
    /**
     * @en Sensor, such as checking if the positioning sensor is available, pass in the `Geolocation` sensor construction function
     * @zh 传感器，比如检查定位传感器是否可用，传入 `Geolocation` 传感器构造函数
     */
    type Sensor = object

    /**
     * @en `true` - auto-brightness is set to on, `false` - auto-brightness is set to off
     * @zh `true` - 传感器在当前设备可用，`false` - 传感器在当前设备不可用
     */
    type Result = boolean
  }

  /**
   * @en Check the availability of sensors on the current device
   * @zh 检查传感器在当前设备的可用性
   * @version 3.0
   * @example
   * ```js
   * import { checkSensor, Geolocation } from '@zos/sensor'
   *
   * const result = checkSensor(Geolocation)
   * let geolocation = null
   *
   * if (result) {
   *   geolocation = new Geolocation()
   * }
   * ```
   */
  function checkSensor(sensor: checkSensor.Sensor): checkSensor.Result
}

/**
  * @en System Settings
  * @zh 系统设置
  */
declare module '@zos/settings' {

  /**
   * @en year-month-day
   * @zh 年-月-日
   */
  const DATE_FORMAT_YMD: number
  /**
   * @en day-month-year
   * @zh 日-月-年
   */
  const DATE_FORMAT_DMY: number
  /**
   * @en month-day-year
   * @zh 月-日-年
   */
  const DATE_FORMAT_MDY: number
  /**
   * @en 12-hour format
   * @zh 12 小时制
   * @version 2.1
   */
  const TIME_FORMAT_12: number
  /**
   * @en 24-hour format
   * @zh 24 小时制
   * @version 2.1
   */
  const TIME_FORMAT_24: number
  /**
   * @en metric system
   * @zh 公制
   */
  const DISTANCE_UNIT_METRIC: number
  /**
   * @en imperial system
   * @zh 英制
   */
  const DISTANCE_UNIT_IMPERIAL: number
  /**
   * @en Kilogram
   * @zh 千克
   */
  const WEIGHT_UNIT_KILOGRAM: number
  /**
   * @en Jin
   * @zh 斤
   */
  const WEIGHT_UNIT_JIN: number
  /**
   * @en Pound
   * @zh 英磅
   */
  const WEIGHT_UNIT_POUND: number
  /**
   * @en Stone
   * @zh 英石
   */
  const WEIGHT_UNIT_STONE: number
  /**
   * @en Celsius temperature
   * @zh 摄氏温度
   */
  const TEMPERATURE_UNIT_CENTIGRADE: number
  /**
   * @en Fahrenheit temperature
   * @zh 华氏温度
   */
  const TEMPERATURE_UNIT_FAHRENHEIT: number
  namespace getLanguage {
    /**
     * @en Please see the Multilingual Mapping for more details
     * @zh 此处不一一列举，请参考多语言映射
     */
    type Result = number
  }

  /**
   * @en Get the current system language setting
   * @zh 获取当前系统语言设置
   * @example
   * ```js
   * import { getLanguage } from '@zos/settings'
   *
   * const languageCode = getLanguage()
   * console.log(languageCode)
   * ```
   */
  function getLanguage(): getLanguage.Result
  namespace getDateFormat {
    /**
     * @en Date format, value refer to date format constants
     * @zh 日期格式，值参考日期格式常量
     */
    type Result = number
  }

  /**
   * @en Get the current system date format
   * @zh 获取当前系统日期格式
   * @constants dateFormat
   * @example
   * ```js
   * import { getDateFormat, DATE_FORMAT_YMD } from '@zos/settings'
   *
   * const currentDateFormat = getDateFormat()
   *
   * if (currentDateFormat === DATE_FORMAT_YMD) {
   *   console.log('date format is YYYY-MM-DD')
   * }
   * ```
   */
  function getDateFormat(): getDateFormat.Result
  namespace getTimeFormat {
    /**
     * @en Hour format, value refer to hour format constants
     * @zh 小时格式，值参考小时格式常量
     */
    type Result = number
  }

  /**
   * @en Get the current system time format, 12-hour format or 24-hour format
   * @zh 获取当前系统时间格式，12 小时/24 小时
   * @constants hourFormat
   * @version 2.1
   * @example
   * ```js
   * import { getTimeFormat, TIME_FORMAT_24 } from '@zos/settings'
   *
   * const timeFormat = getTimeFormat()
   *
   * if (timeFormat === TIME_FORMAT_24) {
   *   console.log('time format is 24-hour format')
   * }
   * ```
   */
  function getTimeFormat(): getTimeFormat.Result
  namespace getDistanceUnit {
    /**
     * @en Distance units, value refer to distance unit constants
     * @zh 距离单位，值参考距离单位常量
     */
    type Result = number
  }

  /**
   * @en Returns whether the current distance unit is metric or imperial. This method is to get the units set by the user, not to represent the units of the data, the data units refer to the interface description of the corresponding data
   * @zh 返回当前的距离单位是公制还是英制。该方法是获取的是用户设置的单位，不代表数据的单位，数据单位参考相应数据的接口说明
   * @constants distanceUnit
   * @example
   * ```js
   * import { getDistanceUnit, DISTANCE_UNIT_METRIC } from '@zos/settings'
   *
   * const distanceUnit = getDistanceUnit()
   *
   * if (distanceUnit === DISTANCE_UNIT_METRIC) {
   *   console.log('metric')
   * }
   * ```
   */
  function getDistanceUnit(): getDistanceUnit.Result
  namespace getWeightUnit {
    /**
     * @en Weight units, value refer to weight unit constants
     * @zh 重量单位，值参考重量单位常量
     */
    type Result = number
  }

  /**
   * @en Gets the weight unit set by the user
   * @zh 获取用户设置的重量单位
   * @constants weightUnit
   * @example
   * ```js
   * import { getWeightUnit, WEIGHT_UNIT_KILOGRAM } from '@zos/settings'
   *
   * const weightUnit = getWeightUnit()
   *
   * if (weightUnit === WEIGHT_UNIT_KILOGRAM) {
   *   console.log('Kilogram')
   * }
   * ```
   */
  function getWeightUnit(): getWeightUnit.Result
  namespace getWeightTarget {
    /**
     * @en User-set weight target, default is `0`
     * @zh 用户设置的体重目标，默认为 `0`
     */
    type Result = number
  }

  /**
   * @en Get the weight target set by the user
   * @zh 获取用户设置的体重目标
   * @example
   * ```js
   * import { getWeightTarget } from '@zos/settings'
   *
   * const weightTarget = getWeightTarget()
   * console.log(weightTarget)
   * ```
   */
  function getWeightTarget(): getWeightTarget.Result
  namespace getSleepTarget {
    /**
     * @en User-set sleep target, default is `0`, in minutes
     * @zh 用户设置的睡眠目标，默认为 `0`，单位分钟
     */
    type Result = number
  }

  /**
   * @en Get the sleep target set by the user
   * @zh 获取用户设置的睡眠目标
   * @example
   * ```js
   * import { getSleepTarget } from '@zos/settings'
   *
   * const sleepTarget = getSleepTarget()
   * console.log(sleepTarget)
   * ```
   */
  function getSleepTarget(): getSleepTarget.Result
  namespace getTemperatureUnit {
    /**
     * @en Temperature units, value reference temperature unit constants
     * @zh 温度单位，值参考温度单位常量
     */
    type Result = number
  }

  /**
   * @en Get the temperature units set by the user
   * @zh 获取用户设置的温度单位
   * @constants temperatureUnit
   * @version 2.1
   * @example
   * ```js
   * import { getTemperatureUnit, TEMPERATURE_UNIT_CENTIGRADE } from '@zos/settings'
   *
   * const temperatureUnit = getTemperatureUnit()
   *
   * if (temperatureUnit === TEMPERATURE_UNIT_CENTIGRADE) {
   *   console.log('centigrade')
   * }
   * ```
   */
  function getTemperatureUnit(): getTemperatureUnit.Result
  namespace getSystemInfo {
    /**
     * @output
     */
    interface Result {
      /**
       * @en Zepp OS System Version
       * @zh Zepp OS 系统版本
       */
      osVersion: string
      /**
       * @en Device firmware version
       * @zh 设备固件版本
       */
      firmwareVersion: string
      /**
       * @en API_LEVEL
       * @zh API_LEVEL 版本
       */
      minAPI: string
    }
  }

  /**
   * @en Get system related information
   * @zh 获取系统相关信息
   * @version 2.1
   * @example
   * ```js
   * import { getSystemInfo } from '@zos/settings'
   *
   * const { minAPI } = getSystemInfo()
   * console.log(minAPI)
   * ```
   */
  function getSystemInfo(): getSystemInfo.Result
  namespace getSystemMode {
    /**
     * @output
     */
    interface Result {
      /**
       * @en State of Do Not Disturb Mode
       * @zh 勿扰模式开关状态
       */
      DND: boolean
      /**
       * @en State of Sleep Mode
       * @zh 睡眠模式开关状态
       */
      sleep: boolean
      /**
       * @en State of Sleep Mode
       * @zh 剧场模式开关状态
       */
      theater: boolean
      /**
       * @en State of Screen Lock Mode
       * @zh 屏幕锁定开关状态
       */
      systemLock: boolean
      /**
       * @en State of Low Temperature Mode
       * @zh 低温模式开关状态
       */
      lowTemperature: boolean
      /**
       * @en State of Power Saving Mode
       * @zh 省电模式开关状态
       */
      powerSaving: boolean
      /**
       * @en State of Clock Mode
       * @zh 省电时钟模式开关状态
       */
      ultraPowerSaving: boolean
      /**
       * @en State of Button Mode
       * @zh 按键模式开关状态
       */
      button: boolean
      /**
       * @en State of Accessible
       * @zh 无障碍模式开关状态
       */
      accessibleSwitch: boolean
    }
  }

  /**
   * @en Get the system mode setting information
   * @zh 获取系统各种模式的设置信息
   * @version 3.0
   * @example
   * ```js
   * import { getSystemMode } from '@zos/settings'
   *
   * const mode = getSystemMode()
   * console.log(mode)
   * ```
   */
  function getSystemMode(): getSystemMode.Result
}

/**
  * @en Storage
  * @zh 存储
  */
declare module '@zos/storage' {

  /**
   * @en Locally stored key-value pairs, data cleared after Mini Program uninstallation
   * @zh 本地存储的键值对，数据在小程序卸载过后清除
   * @permissionCode device:os.local_storage
   * @example
   * ```js
   * import { localStorage } from '@zos/storage'
   *
   * localStorage.setItem('test', 'test value')
   * const val = localStorage.getItem('test')
   * const defaultValue = localStorage.getItem('none_key', 'defaultValue')
   *
   * localStorage.removeItem('test')
   * localStorage.clear()
   * ```
   */
  interface localStorage {
    /**
     * @en Get sleep information
     * @zh 保存数据
     */
    setItem(key: string, value: any): void
    /**
     * @en Read the data, specify the default value `defaultValue`, and return `defaultValue` if the value on the specified `key` is not retrieved.
     * @zh 读取数据，指定默认值 `defaultValue` 后，如果没有获取到指定 `key` 上的值，返回 `defaultValue`
     */
    getItem(key: string, defaultValue?: any): void
    /**
     * @en Delete the data of the specified `key`
     * @zh 删除所指定 `key` 的数据
     */
    removeItem(key: string): void
    /**
     * @en Clear all data in localStorage
     * @zh 清空 localStorage 中所有数据
     */
    clear(): void
  }

  const localStorage: localStorage
  /**
   * @en Locally stored key-value pairs, data cleared after Mini Program uninstallation
   * @zh 本地存储的键值对，数据在小程序卸载过后清除
   * @permissionCode device:os.local_storage
   * @version 3.0
   * @example
   * ```js
   * import { LocalStorage } from '@zos/storage'
   *
   * const localStorage = new LocalStorage()
   * localStorage.setItem('test', 'test value')
   * const val = localStorage.getItem('test')
   * const defaultValue = localStorage.getItem('none_key', 'defaultValue')
   *
   * localStorage.removeItem('test')
   * localStorage.clear()
   * ```
   */
  class LocalStorage {
    /**
     * @en Get sleep information
     * @zh 保存数据
     */
    setItem(key: string, value: any): void
    /**
     * @en Read the data, specify the default value `defaultValue`, and return `defaultValue` if the value on the specified `key` is not retrieved.
     * @zh 读取数据，指定默认值 `defaultValue` 后，如果没有获取到指定 `key` 上的值，返回 `defaultValue`
     */
    getItem(key: string, defaultValue?: any): void
    /**
     * @en Delete the data of the specified `key`
     * @zh 删除所指定 `key` 的数据
     */
    removeItem(key: string): void
    /**
     * @en Clear all data in localStorage
     * @zh 清空 localStorage 中所有数据
     */
    clear(): void
  }
  /**
   * @en Key-value pairs are stored and data is cleared after exiting the Mini Program
   * @zh 键值对存储，数据在退出小程序后清除
   * @example
   * ```js
   * import { sessionStorage } from '@zos/storage'
   *
   * sessionStorage.setItem('test', 'test value')
   * const val = sessionStorage.getItem('test')
   * const defaultValue = sessionStorage.getItem('none_key', 'defaultValue')
   *
   * sessionStorage.removeItem('test')
   * sessionStorage.clear()
   * ```
   */
  interface sessionStorage {
    /**
     * @en Get sleep information
     * @zh 保存数据
     */
    setItem(key: string, value: any): void
    /**
     * @en Read the data, specify the default value `defaultValue`, and return `defaultValue` if the value on the specified `key` is not retrieved.
     * @zh 读取数据，指定默认值 `defaultValue` 后，如果没有获取到指定 `key` 上的值，返回 `defaultValue`
     */
    getItem(key: string, defaultValue?: any): void
    /**
     * @en Delete the data of the specified `key`
     * @zh 删除所指定 `key` 的数据
     */
    removeItem(key: string): void
    /**
     * @en Clear all data in sessionStorage
     * @zh 清空 sessionStorage 中所有数据
     */
    clear(): void
  }

  const sessionStorage: sessionStorage
  /**
   * @en Key-value pairs are stored and data is cleared after exiting the Mini Program
   * @zh 键值对存储，数据在退出小程序后清除
   * @example
   * ```js
   * import { SessionStorage } from '@zos/storage'
   *
   * const sessionStorage = new SessionStorage()
   * sessionStorage.setItem('test', 'test value')
   * const val = sessionStorage.getItem('test')
   * const defaultValue = sessionStorage.getItem('none_key', 'defaultValue')
   *
   * sessionStorage.removeItem('test')
   * sessionStorage.clear()
   * ```
   */
  class SessionStorage {
    /**
     * @en Get sleep information
     * @zh 保存数据
     */
    setItem(key: string, value: any): void
    /**
     * @en Read the data, specify the default value `defaultValue`, and return `defaultValue` if the value on the specified `key` is not retrieved.
     * @zh 读取数据，指定默认值 `defaultValue` 后，如果没有获取到指定 `key` 上的值，返回 `defaultValue`
     */
    getItem(key: string, defaultValue?: any): void
    /**
     * @en Delete the data of the specified `key`
     * @zh 删除所指定 `key` 的数据
     */
    removeItem(key: string): void
    /**
     * @en Clear all data in sessionStorage
     * @zh 清空 sessionStorage 中所有数据
     */
    clear(): void
  }
}

/**
  * @en timer
  * @zh 系统定时器
  */
declare module '@zos/timer' {

  namespace createSysTimer {
    /**
     * @en Whether to create a periodic timer
     * @zh 是否创建周期性定时器
     */
    type Periodic = boolean

    /**
     * @en Timer period (ms). For non-periodic timers, it represents delay duration, 0 means immediate execution
     * @zh 定时周期（毫秒）。非周期性定时器时表示延迟时长，0 表示立即执行
     */
    type Period = number

    /**
     * @en Callback function
     * @zh 回调函数
     */
    type Callback = (arg?: unknown) => void

    /**
     * @en Parameter passed to the callback function
     * @zh 传递给回调函数的参数
     */
    type Arg = unknown

    /**
     * @en The ID returned by creating a system timer, used to stop the timer later
     * @zh 创建系统定时器返回的 ID，用于后续停止定时器
     */
    type Result = number
  }

  /**
   * @en A system-level timer that can be registered in device app services and runs regardless of watch screen state
   * @zh 在设备应用服务中可以注册的定时器，在系统级别运行，不受手表息屏影响
   * @version 4.0
   * @example
   * ```js
   * import { createSysTimer } from '@zos/timer'
   *
   * // Create a non-periodic timer that executes after 5 seconds
   * const timerId = createSysTimer(false, 5000, (param) => {
   *   console.log('timer callback with param:', param)
   * }, 'customParam')
   *
   * // Create a periodic timer that executes every 10 seconds
   * const intervalId = createSysTimer(true, 10000, () => {
   *   console.log('interval timer callback')
   * })
   * ```
   */
  function createSysTimer(
    periodic: createSysTimer.Periodic,
    period: createSysTimer.Period,
    callback: createSysTimer.Callback,
    arg?: createSysTimer.Arg,
  ): createSysTimer.Result
  namespace stopTimer {
    /**
     * @en Timer ID to be stopped, returned by `createSysTimer` method
     * @zh 需要停止的定时器 ID，由 `createSysTimer` 方法返回
     */
    type TimerId = number
  }

  /**
   * @en Stop the timer created by `createSysTimer` method
   * @zh 停止由 `createSysTimer` 方法创建的定时器
   * @version 4.0
   * @example
   * ```js
   * import { createSysTimer, stopTimer } from '@zos/timer'
   *
   * // Create a periodic timer that executes every 10 seconds
   * const timerId = createSysTimer(true, 10000, () => {
   *   console.log('Execute every 10 seconds')
   * })
   *
   * // Stop the timer after 5 seconds
   * createSysTimer(false, 5000, () => {
   *   stopTimer(timerId)
   *   console.log('Timer stopped')
   * })
   * ```
   */
  function stopTimer(timerId: stopTimer.TimerId): void
}

/**
  * @en Transfer File
  * @zh 文件传输
  */
declare module '@zos/transfer-file' {

}
declare module '@zos/ui' {
  
  type Id<T> = { [K in keyof T]: T[K] }

  namespace HmWearableProgram {
    namespace DeviceSide {
        namespace HmUI {
            interface IHmUIPropertyType {
                MORE: number;
                /**
                 * @en x coordinate
                 * @zh x 坐标
                 */
                X: number;
                /**
                 * @en y coordinate
                 * @zh y 坐标
                 */
                Y: number;
                /**
                 * @en Width
                 * @zh 宽度
                 */
                W: number;
                /**
                 * @en Height
                 * @zh 高度
                 */
                H: number;
                POS_X: number;
                POS_Y: number;
                ANGLE: number;
                CENTER_X: number;
                CENTER_Y: number;
                /**
                 * @en Resource Path
                 * @zh 资源路径
                 */
                SRC: number;
                /**
                 * @en Text Content
                 * @zh 文字内容
                 */
                TEXT: number;
                /**
                 * @en Text size
                 * @zh 文字大小
                 */
                TEXT_SIZE: number;
                COLOR: number;
                START_ANGLE: number;
                END_ANGLE: number;
                LINE_WIDTH: number;
                LINE_PROGRESS_START_X: number;
                LINE_PROGRESS_START_Y: number;
                LINE_PROGRESS_END_X: number;
                LINE_PROGRESS_END_Y: number;
                LINE_PROGRESS_PROGRESS: number;
                LINE_PROGRESS_SRC_BG: number;
                LINE_PROGRESS_SRC_PROGRESS: number;
                LINE_PROGRESS_SRC_INDICATOR: number;
                WORD_WRAP: number;
                ID: number;
                DATASET: number;
                VISIBLE: number;
            }

            interface IHmUIWidgetType {
                /**
                 * @en GROUP group component is used to group a series of components together for unified widget of show/hide, registering events, etc
                 * @zh GROUP 组控件用于将一系列控件分组，便于统一控制显示/隐藏，注册事件等
                 */
                GROUP: number;
                /**
                 * @en The image widget is used to display images and supports image rotation
                 * @zh 图片控件用于展示图片，支持图片旋转
                 */
                IMG: number;
                /**
                 * @en Image group widget is used to show an image carousel, mainly for watchface photo rotation
                 * @zh 图片轮播控件用于展示多张图片轮播，主要用于表盘照片轮播
                 */
                IMG_GROUP: number;
                /**
                 * @en Text component for displaying text. Support setting text size, color and alignment
                 * @zh 文本控件用于展示文本。支持设置文本大小、颜色、对齐方式
                 */
                TEXT: number;
                /**
                 * @en Arc widget to display arc progress. Support setting line width, color, start and end angle
                 * @zh 圆弧控件展示圆弧进度。支持设置线宽、颜色、开始和结束的角度
                 */
                ARC: number;
                /**
                 * @en The Fill Rectangle widget is used to draw a solid color rectangular area
                 * @zh 填充矩形控件用于绘制一个纯色矩形区域
                 */
                FILL_RECT: number;
                /**
                 * @en The stroked rectangle widget adds a stroke on the basis of the filled rectangle component
                 * @zh 描边矩形控件在填充矩形控件的基础上加入了描边
                 */
                STROKE_RECT: number;
                TEXT_IMG: number;
                ARC_PROGRESS: number;
                IMG_PROGRESS: number;
                IMG_ARC_PROGRESS: number;
                IMG_LEVEL: number;
                /**
                 * @en Play the pre-given image at the set frame rate to create an animation effect
                 * @zh 按照设置的帧率播放预先给定的图片，形成动画效果
                 */
                IMG_ANIM: number;
                /**
                 * @en The button widget supports setting images and colors for normal and pressed states
                 * @zh 按钮控件支持设置正常态和按压态的颜色或者图片
                 */
                BUTTON: number;
                /**
                 * @en Numeric keyboard widget supporting key add, delete and parameter updates
                 * @zh 数字键盘控件，支持按键的添加、删除以及参数修改
                 */
                KEYBOARD: number;
                /**
                 * @en Horizontal progress bar
                 * @zh 横向进度条
                 */
                LINE_PROGRESS: number;
                /**
                 * @en Button group container used to manage variant buttons
                 * @zh 按钮组容器，用于管理可变样式按钮
                 */
                BUTTON_GROUP: number;
                /**
                 * @en Variant button
                 * @zh 可变样式按钮
                 */
                VARIANT_BUTTON: number;
                /**
                 * @en Draws a circle with support for color, transparency, and other properties
                 * @zh 绘制一个圆形，支持颜色、透明度等属性
                 */
                CIRCLE: number;
                /**
                 * @en Dialog popup consists of a piece of text and two buttons. The popup box disappears when the buttons are clicked
                 * @zh 对话弹窗由一段文本和两个按钮构成，点击按钮后弹框会消失
                 */
                DIALOG: number;
                /**
                 * @en Create a sliding list area, which can be filled with pictures and text
                 * @zh 创建一块支持滑动的列表区域，每个列表的 item 中可以设置图片和文字
                 */
                SCROLL_LIST: number;
                /**
                 * @en Used to switch between open and closed states
                 * @zh 用于在打开和关闭状态之间进行切换
                 */
                SLIDE_SWITCH: number;
                /**
                 * @en Create a list that scrolls in a loop, which can be populated with images
                 * @zh 创建一个可以循环滚动的列表，每个 item 可以设置为一张图片
                 */
                CYCLE_LIST: number;
                /**
                 * @en Create a list that can be scrolled in a loop, filled with images and text
                 * @zh 创建一个可以循环滚动的列表，其中可以填充图片和文字
                 */
                CYCLE_IMAGE_TEXT_LIST: number;
                IMG_POINTER: number;
                /**
                 * @en Used to select a single result among multiple options. Each individual option needs to be created using STATE_BUTTON
                 * @zh 用于在多个选项中选择多个选项。每个选项需要使用 STATE_BUTTON 来创建
                 */
                CHECKBOX_GROUP: number;
                STATE_BUTTON: number;
                /**
                 * @en Used to select a single result among multiple options. Each individual option needs to be created using STATE_BUTTON
                 * @zh 用于在多个选项中选择单个选项。每个单独的选项是 STATE_BUTTON 控件，需要单独创建
                 */
                RADIO_GROUP: number;
                WIDGET_DELEGATE: number;
                /**
                 * @en Draws a histogram
                 * @zh 绘制直方图
                 */
                HISTOGRAM: number;
                /**
                 * @en Time picker widget, providing user choice
                 * @zh 展示时间选择控件，提供用户选择
                 */
                PICK_DATE: number;
                /**
                 * @en Time picker, supporting time and date selection
                 * @zh 时间选择器，支持时间和日期选择
                 */
                TIME_PICKER: number;
                /**
                 * @en Sport data picker widget, providing user choice
                 * @zh 运动扩展编辑控件，提供用户选择数据类型
                 */
                SPORT_DATA: number;
                /**
                 * @en Create a layer, which can add any number of child widgets
                 * @zh 创建一个图层，可以添加任意数量的子控件
                 */
                VIEW_CONTAINER: number;
                /**
                 * @en Group view container
                 * @zh 组件容器
                 */
                GROUP_VIEW: number;
                /**
                 * @en Create a layout virtual container, which can add any number of child widgets
                 * @zh 创建一个布局虚拟容器，可以添加任意数量的子控件
                 */
                VIRTUAL_CONTAINER: number;
                /**
                 * @en Create a data picker widget, providing user choice
                 * @zh 创建一个数据选择控件，提供用户选择数据
                 */
                WIDGET_PICKER: number;
                /**
                 * @en Create a QR code
                 * @zh 创建二维码
                 */
                QRCODE: number;
                /**
                 * @en Create a polyline
                 * @zh 创建多段线
                 */
                POLYLINE: number;
                /**
                 * @en Create a canvas
                 * @zh 创建一个画布
                 */
                CANVAS: number;
                /**
                 * @en Create a page indicator
                 * @zh 创建一个分页指示器
                 */
                PAGE_INDICATOR: number;
                /**
                 * @en Create a page scrollbar
                 * @zh 创建一个页面滚动条
                 */
                PAGE_SCROLLBAR: number;
            }

            type HmUIAttributeType = number;
            type HmUIStyleType = number;
            type HmUIPropertyType = number;
            type HmUIPropertyValue = string | number | boolean | undefined;

            interface IInspector {
                draw(props: {
                      obj?: IHmElement,
                      line_width?: number,
                      line_color?: number,
                      border_mode?: 0 | 1,
                      virtual_cntr?: boolean
                    }): void;
                setVisibleList(ids: number[]): void;
                setViewOffset(xOffset: number, yOffset: number): void;
                clear(): void;
            }

            interface IHmUIWidget {
                setAlpha: (v: number) => void;
                setColor: (v: number) => void;
                setEnable: (s: boolean) => void;
                setProperties: (props: Record<string, unknown>) => void;
                getProperties: (...names: string[]) => Record<string, unknown>;
                visible: boolean;
                x: number;
                y: number;
                w: number;
                h: number;
                children?: IHmUIWidget[];
                layoutParent: IHmUIWidget;
                layoutChildren: IHmUIWidget[];
                isAutoLayout: boolean;
                styleInfo: Record<string, unknown>;
                getId(): number;
                /**
                 * @en Get the UI widget type
                 * @zh 获取 UI 控件类型
                 */
                getType(): number;
                /**
                 * @en Set the properties of the UI widget
                 * @zh 设置 UI 控件属性
                 */
                setProperty(prop: HmUIPropertyType, val: HmUIPropertyValue): boolean;
                /**
                 * @en Get the UI widget properties, use widget.getProperty(hmUI.prop.MORE, {}) to get all the properties of the widget
                 * @zh 获取 UI 控件属性，可以尝试使用 widget.getProperty(hmUI.prop.MORE, {}) 获取 UI 控件的全部属性
                 */
                getProperty<T>(prop: HmUIPropertyType): T | undefined;
                /**
                 * @en Register a listener to the UI widget and the given callback function will be executed when the specified event is triggered
                 * @zh 给 UI 控件注册事件监听器，当触发指定事件时，给定的回调函数就会被执行
                 */
                addEventListener(eventType: HmUIEventType, listener: IHmUIEventListener): boolean;
                /**
                 * @en Remove event listeners registered by the UI widget using the widget.addEventListener method
                 * @zh 删除 UI 控件使用 widget.addEventListener 方法注册的事件监听器
                 */
                removeEventListener(eventType?: HmUIEventType, listener?: IHmUIEventListener): boolean;
                setLayoutParent(e: IHmUIWidget): void;
                addLayoutChild(e: IHmUIWidget, index?: number): void;
                removeLayoutChild(e: IHmUIWidget): void;
                updateLayoutStyle(e: ILayoutStyle): void;
            }

            type LayoutUnitType = string | number;
            type ILayoutStyle = Partial<{
                        /**
                         * @zh 根容器X轴偏移（仅对根容器生效，非根容器用left/right）
                         * 取值：长度字符串（支持px/vw/vh/vmin/vmax/sp/%，未设单位默认px，）
                         * 示例："0"、"10vw"、"5.2vh"、"unscaled(20)"
                         *
                         * @en Root container X-axis offset (only applies to the root container, not applicable to non-root containers, use left/right)
                         */
                        x: LayoutUnitType

                        /**
                         * @zh 根容器Y轴偏移（仅对根容器生效，非根容器用top/bottom）
                         * 取值规则同x，
                         *
                         * @en Root container Y-axis offset (only applies to the root container, not applicable to non-root containers, use top/bottom)
                         */
                        y: LayoutUnitType

                        /**
                         * @zh 容器宽度
                         * 取值：长度字符串（支持所有单位）| "auto"（含text的控件自动计算，）
                         * 示例："60vw"、"auto"、"sww(50)"（、）
                         *
                         * @en Container width
                         */
                        width: LayoutUnitType

                        /**
                         * @zh 容器高度
                         * 取值规则同width，、
                         *
                         * @en Container height
                         */
                        height: LayoutUnitType

                        /**
                         * @zh 容器最小宽度（限定width范围）
                         * 取值：长度字符串（支持所有单位，）
                         *
                         * @en Container minimum width (limits the width range)
                         */
                        min_width: LayoutUnitType

                        /**
                         * @zh 容器最大宽度（限定width范围）
                         * 取值规则同min_width，
                         *
                         * @en Container maximum width (limits the width range)
                         */
                        max_width: LayoutUnitType

                        /**
                         * @zh 容器最小高度（限定height范围）
                         * 取值：长度字符串（支持所有单位，）
                         *
                         * @en Container minimum height (limits the height range)
                         */
                        min_height: LayoutUnitType

                        /**
                         * @zh 容器最大高度（限定height范围）
                         * 取值规则同min_height，
                         *
                         * @en Container maximum height (limits the height range)
                         */
                        max_height: LayoutUnitType

                        /**
                         * @zh 容器上内边距（支持简写padding，不支持%单位）
                         * 取值：长度字符串（支持px/vw/vh等，除%外，）
                         *
                         * @en Container top padding (supports shortcut padding, does not support % units)
                         */
                        padding_top: LayoutUnitType

                        /**
                         * @zh 容器下内边距（支持简写padding，不支持%单位）
                         * 取值规则同padding_top，
                         *
                         * @en Container bottom padding (supports shortcut padding, does not support % units)
                         */
                        padding_bottom: LayoutUnitType

                        /**
                         * @zh 容器左内边距（支持简写padding，不支持%单位）
                         * 取值规则同padding_top，
                         *
                         * @en Container left padding (supports shortcut padding, does not support % units)
                         */
                        padding_left: LayoutUnitType

                        /**
                         * @zh 容器右内边距（支持简写padding，不支持%单位）
                         * 取值规则同padding_top，
                         *
                         * @en Container right padding (supports shortcut padding, does not support % units)
                         */
                        padding_right: LayoutUnitType

                        /**
                         * @zh 容器内边距（简写padding，不支持%单位）
                         * 取值：长度字符串（支持px/vw/vh等，除%外，）
                         * 示例："10"（默认px）、"5vh"
                         *
                         * @en Container padding (shortcut padding, does not support % units)
                         */
                        padding: LayoutUnitType

                        /**
                         * @zh 容器行间隙（支持简写gap，不支持%单位）
                         * 取值：长度字符串（支持px/vw/vh等，除%外，）
                         * 示例："10"（默认px）、"5vh"
                         *
                         * @en Container row gap (shortcut gap, does not support % units)
                         */
                        row_gap: LayoutUnitType

                        /**
                         * @zh 容器列间隙（支持简写gap，不支持%单位）
                         * 取值规则同row_gap，、
                         *
                         * @en Container column gap (shortcut gap, does not support % units)
                         */
                        column_gap: LayoutUnitType

                        /**
                         * @zh 容器内边距（简写padding，不支持%单位）
                         * 取值：长度字符串（支持px/vw/vh等，除%外，）
                         * 示例："10"（默认px）、"5vh"
                         *
                         * @en Container padding (shortcut padding, does not support % units)
                         */
                        gap: LayoutUnitType

                        /**
                         * @zh 容器左侧偏移（用于非根容器相对定位，不支持%单位）
                         * 取值：长度字符串（支持px/vw/vh等，除%外，）
                         * 示例："relative(1vw)"（默认隐式relative修饰，）
                         *
                         * @en Container left offset (for non-root containers, does not support % units)
                         */
                        left: LayoutUnitType

                        /**
                         * @zh 容器右侧偏移（用于非根容器相对定位，不支持%单位）
                         * 取值规则同left，
                         *
                         * @en Container right offset (for non-root containers, does not support % units)
                         */
                        right: LayoutUnitType

                        /**
                         * @zh 容器下侧偏移（用于非根容器相对定位，不支持%单位）
                         * 取值规则同left，
                         *
                         * @en Container bottom offset (for non-root containers, does not support % units)
                         */
                        bottom: LayoutUnitType

                        /**
                         * @zh 容器在父容器内的对齐方式（支持横向+纵向组合）
                         * 取值：横向值 | 横向值+空格+纵向值
                         * 横向枚举："left" | "center" | "right"
                         * 纵向枚举："top" | "middle" | "bottom"
                         * 示例："center"、"center bottom"
                         *
                         * @en Container alignment (supports horizontal+vertical combination)
                         */
                        align:
                          | 'left'
                          | 'center'
                          | 'right'
                          | 'top'
                          | 'middle'
                          | 'bottom'
                          | 'left top'
                          | 'left middle'
                          | 'left bottom'
                          | 'center top'
                          | 'center middle'
                          | 'center bottom'
                          | 'right top'
                          | 'right middle'
                          | 'right bottom'

                        /**
                         * @zh 布局类型（暂不支持grid）
                         * 取值枚举："flex"
                         * @en Layout type (not supported grid)
                         */
                        display: 'flex'

                        /**
                         * @zh flex布局的方向+换行（flex-direction与flex-wrap的合集）
                         * 取值枚举："row" | "row-reverse" | "column" | "column-reverse" | "nowrap" | "wrap" | "wrap-reverse"（、）
                         * 示例："row wrap"
                         *
                         * @en flex layout direction + line wrapping (a collection of flex-direction and flex-wrap)
                         */
                        flex_flow:
                          | 'row'
                          | 'row-reverse'
                          | 'column'
                          | 'column-reverse'
                          | 'nowrap'
                          | 'wrap'
                          | 'wrap-reverse'

                        /**
                         * @zh flex items沿主轴（main轴）的对齐方式
                         * 取值枚举："flex-start" | "start" | "flex-end" | "end" | "center" | "space-between" | "space-around" | "space-evenly"（、）
                         * 说明："flex-start"与"start"等效，"flex-end"与"end"等效
                         *
                         * @en flex items along the main axis
                         */
                        justify_content:
                          | 'flex-start'
                          | 'start'
                          | 'flex-end'
                          | 'end'
                          | 'center'
                          | 'space-between'
                          | 'space-around'
                          | 'space-evenly'

                        /**
                         * @zh cross轴有额外空间时，flex轨道组的对齐方式（默认center）
                         * 取值枚举："flex-start" | "start" | "flex-end" | "end" | "center"
                         *
                         * @en cross-axis with extra space, flex track group alignment (default center)
                         */
                        align_content: 'flex-start' | 'start' | 'flex-end' | 'end' | 'center'

                        /**
                         * @zh flex item的增长能力（值为16位正整数的字符串形式）
                         * 取值：16位正整数转字符串
                         * 示例："1"、"10"
                         *
                         * @en flex item's growth ability (value is a string of a 16-bit positive integer)
                         */
                        flex_grow: LayoutUnitType

                        /**
                         * @zh 扩展特性标签（调试/功能开关，多标签用空格分隔，缩放标签互斥）
                         * 取值枚举："update" | "unscaled" | "scale-with-dpi" | "swdpi" | "scale-with-width" | "sww" | "scale-with-height" | "swh" | "ignore-layout" | "newtrack"（、、）
                         * 说明："scale-with-dpi"与"swdpi"等效，缩放相关标签（unscaled/scale-with-dpi等）不可同时使用
                         * 示例："update swh newtrack"
                         *
                         * @en Extension feature tag (debug/function switch, multiple tags separated by spaces, scale tags are mutually exclusive)
                         */
                        tags:
                          | 'update'
                          | 'unscaled'
                          | 'scale-with-dpi'
                          | 'swdpi'
                          | 'scale-with-width'
                          | 'sww'
                          | 'scale-with-height'
                          | 'swh'
                          | 'ignore-layout'
                          | 'newtrack'
                          | `${'update' | 'unscaled' | 'scale-with-dpi' | 'swdpi' | 'scale-with-width' | 'sww' | 'scale-with-height' | 'swh' | 'ignore-layout' | 'newtrack'} ${'update' | 'unscaled' | 'scale-with-dpi' | 'swdpi' | 'scale-with-width' | 'sww' | 'scale-with-height' | 'swh' | 'ignore-layout' | 'newtrack'}`

                        /**
                         * @zh 文字尺寸（作用于text控件或容器下所有text控件，不支持%单位）
                         * 取值：长度字符串（支持px/sp/vw等，除%外，、）
                         * 示例："24sp"、"swa(18)"
                         *
                         * @en Text size (applies to text controls or all text controls under the container, does not support % units)
                         */
                        font_size: LayoutUnitType

                        /**
                         * @zh 容器圆角（支持单值/双值，%单位参考自身高度）
                         * 取值：单长度字符串 | 双长度字符串（空格分隔，）
                         * 示例："25"（单值，）、"33 20"（双值，rw=33, rh=20）、"20%"（20%*自身height）
                         *
                         * @en Container corner radius (supports single value/double value, % units refer to height)
                         */
                        corner_radius: LayoutUnitType

                        /**
                         * @zh 容器行数限制
                         * 取值：正整数
                         * 示例："2"
                         *
                         * @en Text line limit
                         */
                        line_clamp: LayoutUnitType
                      }>;
            type HmUIWidgetOptions = Record<
                        string,
                        number | string | IHmUIEventListener | undefined | null | Record<string, unknown>
                      > & {
                        /**
                         * @en Parent layout widget
                         * @zh 父布局控件
                         */
                        parent?: IHmUIWidget
                        layout?: ILayoutStyle
                        enable?: boolean
                      };
            type HmUIWidgetType = number;

            interface IHmUIGetTextLayoutOptions {
                text_size: number;
                text_width: number;
                font_name?: string;
                wrapped?: number;
                rows_max?: number;
            }

            interface IHmUIGetTextLayout {
                (text: string, options: IHmUIGetTextLayoutOptions): { width: number; height: number; rows: number; result: number; text: string };
            }

            interface IHmUIFunction {
                /**
                 * @en Create UI widgets
                 * @zh 创建 UI 控件
                 */
                createWidget(widgetType: HmUIWidgetType, options: HmUIWidgetOptions): IHmUIWidget;
                /**
                 * @en Delete the UI widget
                 * @zh 删除 UI 控件
                 */
                deleteWidget(widget: IHmUIWidget): boolean;
                /**
                 * @en Redraw the page to prevent the UI from not refreshing in some cases
                 * @zh 重新绘制页面，防止部分情况下 UI 没有刷新
                 */
                redraw(): void;
            }

            interface IHmUIDialogType {
                show(isShow: boolean): void;
            }

            interface IHmUIExtensionFunction {
                /**
                 * @en Calculate the height and width of the target text after the layout is completed, and does not actually render it, only performs the layout calculation
                 * @zh 计算出目标文本布局完成之后的高度和宽度，并不会实际进行渲染，只进行布局计算
                 */
                getTextLayout: IHmUIGetTextLayout;
                /**
                 * @en update layout
                 * @zh 更新布局
                 */
                updateLayout: (obj: IHmUIWidget) => void;
                pixel: (express: string, refer_width?: boolean) => number | undefined;
                /**
                 * @en Create keyboard
                 * @zh 创建键盘
                 */
                createKeyboard: (obj: {
                      inputType?: number,
                      text: string,
                      onComplete: (ele: IHmUIWidget, result: { data: string }) => void
                      onCancel?: (ele: IHmUIWidget, result: { data: string }) => void
                    }) => void;
                /**
                 * @en Delete keyboard
                 * @zh 删除键盘
                 */
                deleteKeyboard: () => void;
                getRtlLayout(): boolean;
                relayoutRtl(): void;
                /**
                 * @en Show Toast with \n text line feed support
                 * @zh 显示 Toast，支持 \n 文本换行
                 */
                showToast(options: { text: string }): void;
                /**
                 * @en Create a Dialog
                 * @zh 创建 Dialog 对话框
                 */
                createDialog(options: {
                      title: string
                      show: boolean
                      auto_hide?: boolean
                      click_linster: (key: number) => void
                      click_listener: (key: number) => void
                    }): IHmUIDialogType;
                /**
                 * @en Set the entire page to Swipe mode, which can support vertical and horizontal scrolling
                 * @zh 将整个页面设置为 Swipe 轮播模式，可支持纵向、横向滚动
                 */
                setScrollView(enable: boolean, pageHeight?: number, pageCount?: number, isVertical?: boolean, opts?: Record<string, unknown>): boolean;
                /**
                 * @en Set whether the current page can be slid
                 * @zh 设置当前页面是否可以滑动
                 */
                setLayerScrolling(enable: boolean, opts?: Record<string, unknown>): boolean;
                /**
                 * @en After setting the page to Swipe mode with hmUI.setScrollView, you can use hmUI.scrollToPage to jump to the corresponding location and set the animation effect of the jump
                 * @zh 在使用 hmUI.setScrollView 将页面设置为 Swipe 轮播模式后，使用 hmUI.scrollToPage 可以跳转到对应的页面，并且可以设置跳转的动画效果
                 */
                scrollToPage(index: number, animation: boolean): void;
                /**
                 * @en After setting the page to Swipe mode with hmUI.setScrollView, use hmUI.getScrollCurrentPage to get the number of pages currently located
                 * @zh 在使用 hmUI.setScrollView 将页面设置为 Swipe 轮播模式后，使用 hmUI.getScrollCurrentPage 可以获取当前轮播的页数
                 */
                getScrollCurrentPage(): undefined | number;
                /**
                 * @en This interface is only available on square screen devices, set the status bar visible or not
                 * @zh 该接口只在方屏设备上有效，设置状态栏是否可见
                 */
                setStatusBarVisible(visible: boolean): void;
                /**
                 * @en This interface is only available on square screen devices, set the status bar to display text content
                 * @zh 该接口只在方屏设备上有效，设置状态栏显示文本内容
                 */
                updateStatusBarTitle(title: string): void;
                /**
                 * @en Get the font size after system scaling
                 * @zh 获得经过系统缩放后的字体大小
                 */
                getSysFontSize(size: number): number;
                /**
                 *
                 * @en Get the font size after system scaling, support string input
                 * @zh 获得经过系统缩放后的字体大小 ，支持传入字符串
                 */
                sp(size: number | string): number;
                /**
                 * @en Get the length and width of the image.
                 * @zh 获得图片的长宽。
                 * @param {string} path 图片路径
                 * @return {*}  {{width: number, height: number}}
                 * @memberof IHmUIExtensionFunction
                 */
                getImageInfo(p: string): { width: number, height: number };
                /**
                 * @en Set the size of AppWidget
                 * @zh 设置 AppWidget 的大小
                 * @param {{
                 *           h: number
                 *         }} options
                 * @memberof IHmUIExtensionFunction
                 */
                setAppWidgetSize(options: {
                      h: number
                    }): void;
                /**
                 * @en Get the size of AppWidget
                 * @zh 获得 AppWidget 的大小
                 * @return {*}  {{ w: number, h: number, margin: number, radius: number }}
                 * @memberof IHmUIExtensionFunction
                 */
                getAppWidgetSize(): { w: number, h: number, margin: number, radius: number };
                /**
                 * @en Open inspector
                 * @zh 打开 inspector
                 */
                openInspector(): IInspector;
            }

            interface IHmUIAlign {
                /**
                 * @en Vertical axis-top
                 * @zh 竖轴-最上端
                 */
                TOP: number;
                /**
                 * @en Vertical axis-bottommost
                 * @zh 竖轴-最底端
                 */
                BOTTOM: number;
                /**
                 * @en Horizontal axis-left aligned
                 * @zh 横轴-左对齐
                 */
                LEFT: number;
                /**
                 * @en Horizontal axis-align right
                 * @zh 横轴-右对齐
                 */
                RIGHT: number;
                /**
                 * @en Horizontal axis-centered
                 * @zh 横轴-居中
                 */
                CENTER_H: number;
                /**
                 * @en Vertical axis_centered
                 * @zh 竖轴_居中
                 */
                CENTER_V: number;
            }

            interface IHmUIArcType {
                FILL: number;
                LINE: number;
            }

            interface IHmUIDataType {
                BATTERY: number;
                CAL: number;
                DISTANCE: number;
                HEART: number;
                SLEEP: number;
                SPORT_ALTITUDE: number;
                TRACK: number;
            }

            interface IHmUIVariantButtonType {
                SUS_TEXT: number;
                SUS_ICON: number;
                SUS_SIDE_BY_SIDE: number;
                SUS_SEL_AND_BACK: number;
                CPS_TEXT: number;
                CPS_MUL_TEXT: number;
                MUL_TEXT: number;
                CPS_IMAGE: number;
                ROUND: number;
                IMAGE: number;
            }

            interface IHmUIVariantButton {
                type: IHmUIVariantButtonType;
            }

            interface IHmUIEditWidgetGroupType {
                SPORTS: number;
            }

            interface IHmUISportDataType {
                DURATION_NET: number;
                DURATION_CUR_SECTION: number;
                DURATION_PREV_SECTION: number;
                DURATION_AVG_SECTION: number;
                DURATION_CUR_GROUP: number;
                DISTANCE_TOTAL: number;
                DISTANCE_CUR_SECTION: number;
                DISTANCE_PREV_SECTION: number;
                COUNT_TOTAL: number;
                COUNT_CUR_ROPE: number;
                COUNT_BROKEN_ROPE: number;
                COUNT_TOTAL_BOAT: number;
                COUNT_CUR_BOAT: number;
                COUNT_CUR_FITNESS: number;
                GLIDE_COUNT: number;
                GLIDE_TOTAL_DISTANCE: number;
                GLIDE_CUR_DISTANCE: number;
                GLIDE_TOTAL_ALTITUDE: number;
                GLIDE_CUR_ALTITUDE: number;
                CLIMB_UP_FLOORS: number;
                CLIMB_UP_CUR_FLOORS: number;
                CLIMB_UP_PREV_FLOORS: number;
                CLIMB_DOWN_FLOORS: number;
                CLIMB_DOWN_CUR_FLOORS: number;
                CLIMB_DOWN_PREV_FLOORS: number;
                CLIMB_UP_FLOORS_IN_MIN: number;
                CLIMB_UP_TOTAL_ALTITUDE: number;
                CLIMB_UP_CUR_ALTITUDE: number;
                CLIMB_UP_PREV_ALTITUDE: number;
                CLIMB_DOWN_ALTITUDE_TOTAL: number;
                CLIMB_DOWN_CUR_ALTITUDE: number;
                CLIMB_DOWN_PREV_ALTITUDE: number;
                SWIM_TOTAL_LAPS: number;
                SWIM_CUR_LAPS: number;
                SWIM_PREV_LAPS: number;
                SWIM_TOTAL_STROKE_CNT: number;
                SWIM_CUR_STROKE_CNT: number;
                SWIM_PREV_STROKE_CNT: number;
                SWIM_AVG_STROKE_DISTANCE: number;
                SWIM_AVG_SECTION_STROKE_CNT: number;
                SWIM_STROKE_SPEED: number;
                SWIM_CUR_STROKE_SPEED: number;
                SWIM_PREV_STROKE_SPEED: number;
                SWIM_AVG_STROKE_SPEED: number;
                SWIM_AVG_SWOLF: number;
                SWIM_CUR_SWOLF: number;
                SWIM_PREV_SWOLF: number;
                PACE: number;
                PACE_AVG: number;
                PACE_CUR_AVG: number;
                PACE_PREV_AVG: number;
                STRIDE_FREQ: number;
                STRIDE_AVG_FREQ: number;
                STRIDE_CUR_FREQ: number;
                STRIDE_PREV_FREQ: number;
                STRIDE: number;
                STRIDE_AVG: number;
                STRIDE_CUR: number;
                STRIDE_PREV: number;
                STRIDE_COUNT: number;
                SPEED: number;
                SPEED_AVG: number;
                SPEED_AVG_GLIDE: number;
                SPEED_PREV_GLIDE: number;
                SPEED_CUR_SECTION: number;
                SPEED_PREV_SECTION: number;
                SPEED_MAX: number;
                SPEED_VERTICAL: number;
                ALTITUDE: number;
                ALTITUDE_MAX: number;
                ALTITUDE_MIN: number;
                ALTITUDE_AVG: number;
                SLOPE_TOTAL_RISING_DISTANCE: number;
                SLOPE_CUR_RISING_DISTANCE: number;
                SLOPE_PREV_RISING_DISTANCE: number;
                ALTITUDE_TOTAL_UP: number;
                ALTITUDE_CUR_UP: number;
                ALTITUDE_PREV_UP: number;
                ALTITUDE_TOTAL_DOWN: number;
                ALTITUDE_CUR_DOWN: number;
                ALTITUDE_PREV_DOWN: number;
                SLOPE: number;
                SLOPE_AVG: number;
                SLOPE_CUR: number;
                SLOPE_PREV: number;
                SLOPE_GLIDE: number;
                SLOPE_AVG_GLIDE: number;
                SLOPE_CUR_GLIDE: number;
                SLOPE_PREV_GLIDE: number;
                BRANDISH_TOTAL_CNT: number;
                BRANDISH_POSITIVE_CNT: number;
                BRANDISH_NEGATIVE_CNT: number;
                BRANDISH_SERVE_CNT: number;
                CONSUME: number;
                CONSUME_CUR: number;
                BOATING_FREQ: number;
                BOATING_AVG_FREQ: number;
                BOATING_CUR_FREQ: number;
                BOATING_PULL: number;
                BOATING_PUSH: number;
                FREQ: number;
                FREQ_AVG: number;
                FREQ_CUR: number;
                GOLF_SPEED: number;
                GOLF_ANGLE: number;
                GOLF_UP_TIME: number;
                GOLF_DOWN_TIME: number;
                GOLF_BEAT: number;
                GOLF_SWING_COUNTER_GROUP: number;
                GOLF_SWING_COUNTER: number;
                GOLF_AVG_SCORE: number;
                GOLF_SCORE: number;
                HR: number;
                HR_AVG: number;
                HR_CUR_AVG: number;
                HR_INTERVAL: number;
                HR_MAX_PERCENT: number;
                HR_RESERVED_PERCENT: number;
                HR_AVG_MAX_PERCENT: number;
                HR_AVG_RESERVED_PERCENT: number;
                HR_CUR_SECTION: number;
                HR_CUR_MAX_PERCENT: number;
                HR_CUR_RESERVED_PERCENT: number;
                HR_PREV_SECTION: number;
                HR_PREV_MAX_PERCENT: number;
                HR_PREV_RESERED_PERCENT: number;
                PRESSURE: number;
                PRESSURE_AVG: number;
                PRESSURE_CUR: number;
                PRESSURE_PREV: number;
                TEMP: number;
                TEMP_MAX: number;
                TEMP_MIN: number;
                OTHER_SECTION_ORDER: number;
                OTHER_AEROBIC_TE: number;
                OTHER_ANAEROBIC_TE: number;
                OTHER_TRAIN_LOAD: number;
                OTHER_CUR_TIME: number;
                OTHER_SUNRISE_TIME: number;
                OTHER_SUNSET_TIME: number;
                OTHER_BORAMETER: number;
                OTHER_ACTIONNAME: number;
                CHART_HR: number;
                CHART_SPEED: number;
                CHART_STROKE_FREP: number;
                CHART_TE: number;
                CHART_STROKE_SPEED: number;
                CHART_PACE: number;
                CHART_ALTITUDE: number;
                CHART_FREQ: number;
                DEVICE_POWER: number;
                DEVICE_POWER_WEIGHT: number;
                DEVICE_WORK: number;
                DEVICE_AVG_POWER: number;
                DEVICE_MAX_POWER: number;
                DEVICE_3S_AVG_POWER: number;
                DEVICE_10S_AVG_POWER: number;
                DEVICE_30S_AVG_POWER: number;
                DEVICE_LAP_AVG_POWER: number;
                DEVICE_PREV_AVG_POWER: number;
                DEVICE_CADENCE: number;
                DEVICE_FAST_CADENCE: number;
                DEVICE_AVG_CADENCE: number;
                DEVICE_LAP_AVG_CADENCE: number;
                DEVICE_PREV_AVG_CADENCE: number;
                DURATION_GLIDE: number;
                DURATION_TOTAL_CLIMB: number;
                GLIDE_PREV_DISTANCE: number;
                GLIDE_PREV_ALTITUDE: number;
                SPEED_MAX_GLIDE: number;
                SLOPE_GLIDE_MAX: number;
                SLOPE_GLIDE_AVG: number;
                GLIDE_ANGLE_MAX: number;
                GLIDE_ANGLE_AVG: number;
                DURATION_SURFACE: number;
                DURATION_CUR_DIVING: number;
                DURATION_PREV_DIVING: number;
                COUNT_DIVING: number;
                COUNT_CAUGHT: number;
                SPEED_DIVING: number;
                DEPTH: number;
                DEPTH_AVG: number;
                DEPTH_MAX: number;
                DEPTH_MAX_PREV: number;
                HEIGHT: number;
                DESENT_SPEED: number;
                DESENT_SPEED_MAX: number;
                DESENT_SPEED_AVG: number;
                SKYDIVING_HEIGHT: number;
                COUNT_CONTINUOUS_ROPE: number;
            }

            interface IHmAnimStatus {
                START: number;
                STOP: number;
                PAUSE: number;
                RESUME: number;
            }

            interface IHmUIWrapTextStyle {
                WRAP: number;
                CHAR_WRAP: number;
                /**
                 * @en Single line overflow character display...
                 * @zh 单行溢出字符显示...
                 */
                ELLIPSIS: number;
                /**
                 * @en Keep scrolling
                 * @zh 跑马灯
                 */
                NONE: number;
            }

            interface IHmUIEventType {
                /**
                 * @en Lift up
                 * @zh 抬起
                 */
                CLICK_UP: number;
                /**
                 * @en Press
                 * @zh 按下
                 */
                CLICK_DOWN: number;
                /**
                 * @en Move in
                 * @zh 划入
                 */
                MOVE_IN: number;
                /**
                 * @en Move out
                 * @zh 划出
                 */
                MOVE_OUT: number;
                /**
                 * @en Slide
                 * @zh 滑动
                 */
                MOVE: number;
                /**
                 * @en One full click (including press and lift)
                 * @zh 一次完整点击（包含按下和抬起）
                 */
                SELECT: number;
            }

            interface IHmUIEvent {
                x: number;
                y: number;
                type: HmUIEventType;
                target: IHmUIWidget;
            }

            interface IHmUIEventListener {
                (event: IHmUIEvent): void;
            }

            type HmUIEventType = number;
            type IHmUIInputType = {
                        /**
                         * @en emoji
                         * @zh emoji 表情
                         */
                        EMOJI: number
                        /**
                         * @en Number
                         * @zh 数字
                         */
                        NUM: number
                        /**
                         * @en Letter
                         * @zh 字母
                         */
                        CHAR: number
                        /**
                         * @en Voice
                         * @zh 语音
                         */
                        VOICE: number
                        /**
                         * @en Keyboard
                         * @zh 键盘
                         */
                        JSKB: number
                        /**
                         * @en SELECT
                         * @zh 选择
                         */
                        SELECT: number
                      };
            type IHmKeyBoard = {
                        /**
                         * @en Goto input method settings page
                         * @zh 跳转到输入法设置页面
                         */
                        gotoSettings: () => void
                        /**
                         * @en Switch input method type
                         * @zh 切换输入法类型
                         */
                        switchInputType: (type: number) => void
                        /**
                         * @en Get whether the voice ability is available
                         * @zh 获取语音能力是否可用
                         */
                        checkVoiceInputAvailable: () => boolean
                        /**
                         * @en Determine whether the keyboard is set
                         * @zh 判断当前键盘是否被设置
                         */

                        isEnabled: () => boolean
                        /**
                         * @en Determine whether the keyboard is selected
                         * @zh 判断当前键盘是否被选中
                         */
                        isSelected: () => boolean

                        /**
                         * @en Clear input buffer
                         * @zh 清空输入缓冲区
                         */
                        clearBuffer: () => void
                        /**
                         * @en Get input buffer
                         * @zh 获取输入缓冲区
                         */
                        getBuffer: () => string
                        /**
                         * @en Input buffer
                         * @zh 输入缓冲区
                         */
                        inputBuffer: (s: string, text_color?: number, underline_color?: number) => void
                        /**
                         * @en Send key
                         * @zh 发送按键
                         */
                        sendFnKey: (n: number) => void
                        /**
                         * @en Clear input content
                         * @zh 清除输入内容
                         */
                        clearInput: () => void
                        /**
                         * @en Delete character
                         * @zh 删除字符
                         */
                        backspace: (n: number) => void
                        /**
                         * @en Input text
                         * @zh 设置输入内容
                         */
                        inputText: (s: string) => void
                        /**
                         * @en Get input text
                         * @zh 获取输入内容
                         */
                        getTextContext: () => string
                        /**
                         * @en Get input box position
                         * @zh 获取输入框位置
                         */
                        getContentRect: () => {
                          x: number
                          y: number
                          w: number
                          h: number
                        }
                        /**
                         * @en Set input box position
                         * @zh 设置输入框位置
                         */
                        setContentRect: (rect?: { x: number; y: number; w: number; h: number }) => void
                        BACKSPACE: number
                        ENTER: number
                        SWITCH: number
                        SELECT: number
                        CANCEL: number
                      };

            interface IHmUI extends IHmUIExtensionFunction, IHmUIFunction {
                /**
                 * @en Widget Type
                 * @zh 控件类型
                 */
                widget: IHmUIWidgetType;
                /**
                 * @en Widget Property
                 * @zh 控件属性
                 */
                prop: IHmUIPropertyType;
                /**
                 * @en Widget Event
                 * @zh 控件事件
                 */
                event: IHmUIEventType;
                /**
                 * @en Alignment
                 * @zh 对齐方式
                 */
                align: IHmUIAlign;
                /**
                 * @en Arc type
                 * @zh 弧形类型
                 */
                arc_type: IHmUIArcType;
                /**
                 * @en Data type
                 * @zh 数据类型
                 */
                data_type: IHmUIDataType;
                /**
                 * @en Text line wrap handling
                 * @zh 文字换行处理方式
                 */
                text_style: IHmUIWrapTextStyle;
                /**
                 * @en Animation status setting
                 * @zh 动画状态设置
                 */
                anim_status: IHmAnimStatus;
                /**
                 * @en Sport data type
                 * @zh 运动数据类型
                 */
                sport_data: IHmUISportDataType;
                /**
                 * @en Sport type
                 * @zh 运动类型
                 */
                sport_type: number;
                /**
                 * @en Edit widget type
                 * @zh 编辑组件类型
                 */
                edit_widget_group_type: IHmUIEditWidgetGroupType;
                /**
                 * @en Variant button
                 * @zh 可变样式按钮
                 */
                VARIANT_BUTTON: IHmUIVariantButton;
                /**
                 * @en Keyboard type
                 * @zh 键盘类型
                 */
                inputType: IHmUIInputType;
                /**
                 * @en Keyboard
                 * @zh 键盘
                 */
                keyboard: IHmKeyBoard;
            }
        }
    }
}


namespace HmWearableProgram {
    namespace DeviceSide {
        namespace HmUI {
            type extendsBase<T extends { attrs?: object; on?: object; styles?: object }, B extends { attrs?: object; on?: object; styles?: object }> = {
                        attrs?: Id<Partial<T['attrs'] & B['attrs']>>
                        on?: Id<Partial<T['on'] & B['on']>>
                        styles?: Id<Partial<T['styles'] & B['styles']>>
                      };

            interface IHmUIWidgetOptions {
                [k: string]: unknown;
                attrs?: {
                      id?: string
                      dataset?: string
                      [k: string]: unknown
                    };
                on?: {
                      click_up?: IHmUIEventListener
                      click_down?: IHmUIEventListener
                      move_in?: IHmUIEventListener
                      move_out?: IHmUIEventListener
                      move?: IHmUIEventListener
                    };
                styles?: {
                      x?: number
                      y?: number
                      w?: number
                      h?: number
                      [k: string]: unknown
                    };
            }

            interface IHmUIWidgetBasicOptions {
                x: number;
                y: number;
                w: number;
                h: number;
            }

            type GroupWidgetOptions = extendsBase<
                        {
                          styles?: {
                            x: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface GroupWidget extends IHmUIWidget, IHmUIFunction, Omit<IWidgetFactory, 'group'> {
                name: string;
            }

            type CheckBoxGroupWidgetOptions = extendsBase<
                        {
                          attrs: {
                            select_src: string
                            unselect_src: string
                          }
                          styles: {
                            x: number
                            y: number
                            w: number
                            h: number
                          }
                          on: {
                            check_func?: IHmUIEventListener
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface CheckBoxGroupWidget extends IHmUIWidget, IHmUIFunction, Omit<IWidgetFactory, 'group'>, Omit<IWidgetFactory, 'checkboxGroup'> {
                name: string;
            }

            type CheckBoxWidgetOptions = extendsBase<
                        {
                          styles: {
                            x: number
                            y: number
                            w: number
                            h: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface CheckBoxWidget extends IHmUIWidget {
                name: string;
            }

            type RadioGroupWidgetOptions = CheckBoxGroupWidgetOptions;

            interface RadioGroupWidget extends IHmUIWidget, IHmUIFunction, Omit<IWidgetFactory, 'group'>, Omit<IWidgetFactory, 'radioGroup'> {
                name: string;
            }

            type RadioWidgetOptions = CheckBoxWidgetOptions;

            interface RadioWidget extends IHmUIWidget {
                name: string;
            }

            type TextWidgetOptions = extendsBase<
                        {
                          attrs?: {
                            /**
                             * 显示内容
                             *
                             * @type {string}
                             */
                            text?: string
                            text_i18n?: Record<string, string>
                          }
                          styles?: {
                            color?: number
                            alpha?: number
                            align_v?: IHmUIAlign
                            align_h?: IHmUIAlign
                            text_size?: number
                            text_style?: IHmUIWrapTextStyle
                            font?: string
                            line_space?: number
                            char_space?: number
                            start_angle?: number
                            end_angle?: number
                            mode?: number
                            radius?: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface TextWidget extends IHmUIWidget {
                name: string;
                enableCursor(enable: boolean): void;
                getCursorPos(index: number): number;
                getCursorIndex(x: number, y: number): number;
                getTextCount(): number;
                deleteCharacter(index: number): void;
                insertString(index: number, str: string): void;
                getCursorHeight(): number;
                getLineHeight(): number;
                setTextOutline(param: Record<string, unknown>, redraw?: boolean): void;
            }

            type ImageWidgetOptions = extendsBase<
                        {
                          attrs?: {
                            /**
                             * 图片路径
                             *
                             * @type {string}
                             */
                            src?: string
                          }

                          styles?: {
                            alpha?: number
                            auto_scale?: boolean
                            auto_scale_obj_fit?: boolean
                            /**
                             * 图片显示x点 对于控件相对坐标
                             *
                             * @type {number}
                             */
                            pos_x?: number

                            /**
                             * 图片显示y点 对于控件相对坐标
                             *
                             * @type {number}
                             */
                            pos_y?: number

                            /**
                             * 图片旋转角度
                             *
                             * @type {number}
                             */
                            angle?: number

                            /**
                             * 图片旋转中心 x 坐标
                             *
                             * @type {number}
                             */
                            center_x?: number

                            /**
                             * 图片旋转中心 y 坐标
                             *
                             * @type {number}
                             */
                            center_y?: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImageWidget extends IHmUIWidget {
                name: string;
            }

            type ArcWidgetOptions = extendsBase<
                        {
                          styles?: {
                            /**
                             * 圆弧开始角度
                             *
                             * @type {number}
                             */
                            start_angle?: number

                            /**
                             * 圆弧结束角度
                             *
                             * @type {number}
                             */
                            end_angle?: number

                            /**
                             * 圆弧线宽
                             *
                             * @type {number}
                             */
                            line_width?: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface ArcWidget extends IHmUIWidget {
                name: string;
            }

            type FillRectWidgetOptions = extendsBase<
                        {
                          styles: {
                            x: number
                            y: number
                            w: number
                            h: number
                            color: number
                            radius: number
                            angle: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface FillRectWidget extends IHmUIWidget {
                name: string;
            }

            type StrokeRectWidgetOptions = extendsBase<
                        {
                          attrs: {
                            id: string
                          }
                          styles: {
                            x: number
                            y: number
                            w: number
                            h: number
                            color: number
                            radius: number
                            line_width: number
                            angle: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface StrokeRectWidget extends IHmUIWidget {
                name: string;
            }

            type ImgTextWidgetOptions = extendsBase<
                        {
                          attrs: {
                            text: string
                          }
                          styles: {
                            x: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImgTextWidget extends IHmUIWidget {
                name: string;
            }

            type ImgGroupWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x: number
                            y: number
                            w?: number
                            h?: number
                            image_array: Array<string>
                            image_length?: number
                            src?: string
                            mode?: number
                            show_level?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImgGroupWidget extends IHmUIWidget {
                name: string;
            }

            type ArcProgressWidgetOptions = extendsBase<
                        {
                          attrs: {
                            center_x: number
                            center_y: number
                            radius: number
                            start_angle: number
                            end_angle: number
                            line_width: number
                            color: number
                            src_bg?: string
                            level?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ArcProgressWidget extends IHmUIWidget {
                name: string;
            }

            type LineProgressWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x: number
                            y: number
                            w: number
                            h: number
                            track_fill?: {
                              alpha?: number
                              radius?: number
                              color?: number
                            }
                            progress_fill: {
                              alpha?: number
                              radius?: number
                              color?: number
                            }
                            progress?: number
                            type?: number
                          }
                          styles: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface LineProgressWidget extends IHmUIWidget {
                name: string;
            }

            type ImgProgressWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x: Array<number>
                            y: Array<number>
                            image_array: Array<string>
                            image_length: number
                            level?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImgProgressWidget extends IHmUIWidget {
                name: string;
            }

            type ImgProgressLevelWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x: number
                            y: number
                            image_array: Array<string>
                            image_length: number
                            w?: number
                            h?: number
                            level?: number
                            shortcut?: boolean
                            type?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImgProgressLevelWidget extends IHmUIWidget {
                name: string;
            }

            type ImgAnimationWidgetOptions = extendsBase<
                        {
                          attrs: {
                            anim_path: string
                            anim_prefix: string
                            anim_ext: string
                            anim_fps: number
                            anim_size: number
                            repeat_count: number
                            anim_status: number
                          }
                          styles: {
                            x: number
                            y: number
                          }
                          on: {
                            anim_complete_call: IHmUIEventListener
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImgAnimationWidget extends IHmUIWidget {
                name: string;
            }

            type ImgArcProgressWidgetOptions = extendsBase<
                        {
                          attrs: {
                            center_x: number
                            center_y: number
                            radius: number
                            start_angle: number
                            end_angle: number
                            arc_type: number
                            src: string
                            pos_x?: number
                            pos_y?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ImgArcProgressWidget extends IHmUIWidget {
                name: string;
            }

            type ButtonWidgetOptions = extendsBase<
                        {
                          attrs: {
                            text: string
                            color?: number
                            press_src?: string
                            normal_src?: string
                            press_color?: number
                            normal_color?: number
                            click_func?: IHmUIEventListener
                            longpress_func?: IHmUIEventListener
                          }
                          styles: {
                            x: number
                            y: number
                            w: number
                            h: number
                            align_h?: IHmUIAlign
                            align_v?: IHmUIAlign
                            text_size?: number
                            text_w?: number
                            font?: string
                            radius?: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface ButtonWidget extends IHmUIWidget {
                name: string;
            }

            type KeyboardKeyAttr = {
                        id: number
                        x: number
                        y: number
                        text?: string
                        image?: string
                        value?: number | string
                        cntr_coord_style?: boolean
                      };
            type KeyboardWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x?: number
                            y?: number
                            click_func: (keyboard: KeyboardWidget, id: number, value: number | string, mode: number) => void
                            key_attr: KeyboardKeyAttr[]
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface KeyboardWidget extends IHmUIWidget {
                name: string;
            }

            type ButtonGroupWidgetOptions = extendsBase<
                        {
                          attrs: {
                            maxBtnCnt?: number
                            target?: IHmUIWidget
                            floating?: boolean
                            focusLoop?: boolean
                            scrollEnable?: boolean
                            zIndex?: number
                            enable?: boolean
                          }
                          styles: IHmUIWidgetBasicOptions
                          on?: {
                            focusChange?: IHmUIEventListener
                            focusOver?: IHmUIEventListener
                            focusEnd?: IHmUIEventListener
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface ButtonGroupWidget extends IHmUIWidget, IHmUIFunction {
                name: string;
                init(): boolean;
            }

            type VariantButtonWidgetOptions = extendsBase<
                        {
                          attrs: {
                            type: number
                            imageW?: number
                            imageH?: number
                            src?: string
                            leftImage?: string
                            rightImage?: string
                            selectImage?: string
                            backImage?: string
                            backVisible?: boolean
                            selVisible?: boolean
                            leftFocus?: boolean
                            rightFocus?: boolean
                            text?: string
                            subText?: string
                            systemStyle?: boolean
                            index?: number
                            click_func?: IHmUIEventListener
                          }
                          styles: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface VariantButtonWidget extends IHmUIWidget {
                name: string;
            }

            type GroupViewWidgetOptions = extendsBase<
                        {
                          attrs: {
                            count: number
                            btnClickFunc?: IHmUIEventListener
                            focusLoop?: boolean
                            target?: IHmUIWidget
                          }
                          styles: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface GroupViewWidget extends IHmUIWidget, IHmUIFunction {
                name: string;
                init(): boolean;
                createLine(groupIndex: number): boolean;
                addGroup(insertIndex: number, groupWidget: IHmUIWidget, topMargin?: number): boolean;
                addLine(insertIndex: number, topMargin?: number): boolean;
                setItemTopMargin(groupIndex: number, topMargin: number): boolean;
                setItemVisible(groupIndex: number, visible: boolean): boolean;
                setDirty(groupIndex: number): boolean;
                relayout(groupIndex?: number): boolean;
                setItemToView(groupIndex: number, alignTop?: boolean): boolean;
                addPslImageCapButton(groupIndex: number, imagePath: string): boolean;
                addPslIconButton(groupIndex: number): boolean;
                addPslNormalCapButton(groupIndex: number, text: string): boolean;
                setItemIsButton(groupIndex: number, buttonIndex: number): boolean;
            }

            type CircleWidgetOptions = extendsBase<
                        {
                          styles: {
                            center_x: number
                            center_y: number
                            radius: number
                            color: number
                            alpha?: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface CircleWidget extends IHmUIWidget {
                name: string;
            }

            type DialogWidgetOptions = extendsBase<
                        {
                          attrs: {
                            text: string
                            content_text_size?: number
                            content_text_color?: number
                            content_bg_color?: number
                            content_text_align_h?: IHmUIAlign
                            content_text_align_v?: IHmUIAlign
                            ok_text?: string
                            cancel_text?: string
                            ok_press_color?: number
                            ok_normal_color?: number
                            ok_press_src?: string
                            ok_normal_src?: string
                            cancel_press_color?: number
                            cancel_normal_color?: number
                            cancel_press_src?: string
                            cancel_normal_src?: string
                            ok_text_color?: number
                            cancel_text_color?: number
                            dialog_align_h?: IHmUIAlign
                            dialog_align_v?: IHmUIAlign
                            ok_func?: IHmUIEventListener
                            cancel_func?: IHmUIEventListener
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface DialogWidget extends IHmUIWidget {
                name: string;
            }

            type ViewContainerScrollInfo = {
                        type?: number
                        yoffset?: number
                      };
            type ViewContainerWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x?: number
                            y?: number
                            w?: number
                            h?: number
                            pos_x?: number
                            pos_y?: number
                            page?: number
                            modal?: number
                            z_index?: number
                            bounce?: number
                            scroll_enable?: number
                            scroll_frame_func?: (info: ViewContainerScrollInfo) => void
                            scroll_complete_func?: (info: ViewContainerScrollInfo) => void
                            horizontal?: boolean
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ViewContainerWidget extends IHmUIWidget, IHmUIFunction, Omit<IWidgetFactory, 'group'> {
                name: string;
            }

            type VirtualContainerWidgetOptions = extendsBase<
                        {
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface VirtualContainerWidget extends IHmUIWidget, IHmUIFunction, Omit<IWidgetFactory, 'group'> {
                name: string;
            }

            type QrcodeWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x: number
                            y: number
                            w: number
                            h: number
                            content: string
                            bg_x?: number
                            bg_y?: number
                            bg_w?: number
                            bg_h?: number
                            bg_radius?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface QrcodeWidget extends IHmUIWidget {
                name: string;
            }

            type PageIndicatorWidgetOptions = extendsBase<
                        {
                          attrs: {
                            x: number
                            y: number
                            w: number
                            h: number
                            align_h?: IHmUIAlign
                            h_space?: number
                            v_space?: number
                            select_src: string
                            unselect_src: string
                            use_color?: boolean
                            select_color?: number
                            unselect_color?: number
                            element_height?: number
                            element_radius?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface PageIndicatorWidget extends IHmUIWidget {
                name: string;
            }

            type PageScrollbarWidgetOptions = extendsBase<
                        {
                          attrs?: {
                            target?: IHmUIWidget
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface PageScrollbarWidget extends IHmUIWidget {
                name: string;
            }

            type TimePickerWidgetOptions = extendsBase<
                        {
                          attrs: {
                            type: 0 | 1
                            style: 1
                            title?: string
                            done_icon?: string
                            font_size: number
                            select_font_size: number
                            initHour?: number
                            initMin?: number
                            startYear?: number
                            endYear?: number
                            initYear?: number
                            initMonth?: number
                            initDay?: number
                            picker_cb?: (picker: TimePickerWidget, event_type: number, column: number, value_index: number) => void
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface TimePickerWidget extends IHmUIWidget {
                name: string;
            }

            type WidgetPickerColumnConfig = {
                        data_array: Array<string | number>
                        support_loop: boolean
                        unit?: string
                        connector?: string
                        font_name?: string
                        font_size?: number
                        select_font_size?: number
                        connector_font_size?: number
                        unit_font_size?: number
                        init_val_index?: number
                        col_width?: number
                        layout?: Record<string, string>
                        is_string?: boolean
                      };
            type WidgetPickerWidgetOptions = extendsBase<
                        {
                          attrs: {
                            nb_of_columns: number
                            data_config: WidgetPickerColumnConfig[]
                            title?: string
                            subtitle?: string
                            done_icon?: string
                            picker_cb?: (picker: WidgetPickerWidget, event_type: number, column: number, value_index: number) => void
                            init_col_index?: number
                            normal_color?: number
                            select_color?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface WidgetPickerWidget extends IHmUIWidget {
                name: string;
            }

            type SportDataWidgetOptions = extendsBase<
                        {
                          attrs: {
                            edit_id: number
                            category: number
                            default_type: number
                            optional_types?: number[]
                            count?: number
                            line_color?: number
                            text_size?: number
                            text_color?: number
                            text_x?: number
                            text_y?: number
                            text_w?: number
                            text_h?: number
                            rect_visible?: boolean
                            sub_text_visible?: boolean
                            sub_text_size?: number
                            sub_text_color?: number
                            sub_text_x?: number
                            sub_text_y?: number
                            sub_text_w?: number
                            sub_text_h?: number
                          }
                          styles?: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface SportDataWidget extends IHmUIWidget {
                name: string;
            }

            type CanvasPaintOptions = {
                        color?: number
                        line_width?: number
                      };
            type CanvasCoord = number | string;
            type CanvasDrawPointOptions = {
                        x: CanvasCoord
                        y: CanvasCoord
                        color?: number
                      };
            type CanvasDrawLineOptions = {
                        x1: CanvasCoord
                        y1: CanvasCoord
                        x2: CanvasCoord
                        y2: CanvasCoord
                        color?: number
                        line_width?: number
                      };
            type CanvasDrawRectOptions = {
                        x: CanvasCoord
                        y: CanvasCoord
                        w: CanvasCoord
                        h: CanvasCoord
                        color?: number
                        alpha?: number
                        line_width?: number
                        radius?: number
                      };
            type CanvasDrawArcOptions = {
                        x: CanvasCoord
                        y: CanvasCoord
                        w: CanvasCoord
                        h: CanvasCoord
                        color?: number
                        alpha?: number
                        line_width?: number
                        start_angle?: number
                        end_angle?: number
                      };
            type CanvasDrawCircleOptions = {
                        center_x: CanvasCoord
                        center_y: CanvasCoord
                        radius: CanvasCoord
                        color?: number
                        alpha?: number
                        line_width?: number
                      };
            type CanvasDrawEllipseOptions = {
                        center_x: CanvasCoord
                        center_y: CanvasCoord
                        radius_x: CanvasCoord
                        radius_y: CanvasCoord
                        color?: number
                        alpha?: number
                        line_width?: number
                      };
            type CanvasDrawTextOptions = {
                        cntr_coord_style?: boolean
                        x: CanvasCoord
                        y: CanvasCoord
                        text: string
                        color?: number
                        alpha?: number
                        text_size?: number
                      };
            type CanvasDrawImageOptions = {
                        x: CanvasCoord
                        y: CanvasCoord
                        w: CanvasCoord
                        h: CanvasCoord
                        image: string
                        alpha?: number
                      };
            type CanvasPolygonPoint = {
                        x: number
                        y: number
                      };
            type CanvasPolygonOptions = {
                        color?: number
                        data_array: Array<CanvasPolygonPoint>
                      };
            type CanvasTransformOptions = {
                        sx?: number
                        sy?: number
                        rotation?: number
                      };
            type CanvasClearOptions = {
                        x: CanvasCoord
                        y: CanvasCoord
                        w: CanvasCoord
                        h: CanvasCoord
                      };
            type CanvasWidgetOptions = extendsBase<
                        {
                          attrs?: {
                            cntr_coord_style?: boolean
                          }
                          styles?: IHmUIWidgetBasicOptions & {
                            alpha?: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface CanvasWidget extends IHmUIWidget {
                name: string;
                setPaint(opts: CanvasPaintOptions): void;
                drawPixel(opts: CanvasDrawPointOptions): void;
                drawLine(opts: CanvasDrawLineOptions): void;
                drawRect(opts: CanvasDrawRectOptions): void;
                drawCircle(opts: CanvasDrawCircleOptions): void;
                strokeCircle(opts: CanvasDrawCircleOptions): void;
                drawEllipse(opts: CanvasDrawEllipseOptions): void;
                strokeEllipse(opts: CanvasDrawEllipseOptions): void;
                drawArc(opts: CanvasDrawArcOptions): void;
                strokeArc(opts: CanvasDrawArcOptions): void;
                drawText(opts: CanvasDrawTextOptions): void;
                drawImage(opts: CanvasDrawImageOptions): void;
                drawPoly(opts: CanvasPolygonOptions): void;
                strokePoly(opts: CanvasPolygonOptions): void;
                clear(opts?: CanvasClearOptions): void;
                transform(opts: CanvasTransformOptions): void;
                addEventListener(eventType: HmUIEventType, listener: IHmUIEventListener): boolean;
            }

            namespace SCROLL_LIST {
                namespace view_type {
                    const TEXT: number;
                    const IMAGE: number;
                    const FILL: number;
                }

                namespace snap_type {
                    const SNAPCENTER_ALL: number;
                    const SNAPCENTER_EXCEPTTITLE: number;
                    const SNAP_TOP: number;
                    const SNAP_BOTTOM: number;
                }
            }

            type ScrollListDataItemOptions = Record<string, unknown> & {
                        type_id?: number
                      };
            type ScrollListLayoutViewOptions = {
                        layout: Record<string, unknown>
                      };
            type ScrollListLayoutConfigChildOptions = {
                        view_type: number
                        id: number
                      };
            type ScrollListLayoutConfigOptions = {
                        parent_id: number
                        children: Array<ScrollListLayoutConfigChildOptions>
                        child_cnt: number
                      };
            type ScrollListTextViewOptions = Partial<IHmUIWidgetBasicOptions> & {
                        key: string
                        color?: number
                        text_size?: number
                        action?: boolean
                        bg_color?: number
                        bg_alpha?: number
                        pos_x?: number
                        text_w?: number
                        bg_radius?: number
                        text_style?: number
                        line_space?: string
                        layout?: Record<string, unknown>
                      };
            type ScrollListImageViewOptions = Partial<IHmUIWidgetBasicOptions> & {
                        key: string
                        action?: boolean
                        layout?: Record<string, unknown>
                      };
            type ScrollListFillViewOptions = Partial<IHmUIWidgetBasicOptions> & {
                        key: string
                        action?: boolean
                        radius?: number
                        alpha?: number
                        layout?: Record<string, unknown>
                      };
            type ScrollListItemConfigOptions = {
                        type_id?: number
                        item_height: number
                        item_bg_color: number
                        item_bg_radius: number
                        text_view?: Array<ScrollListTextViewOptions>
                        text_view_count?: number
                        image_view?: Array<ScrollListImageViewOptions>
                        image_view_count?: number
                        fill_view?: Array<ScrollListFillViewOptions>
                        fill_view_count?: number
                        item_press_effect?: boolean
                        layout_view?: Array<ScrollListLayoutViewOptions>
                        layout_view_count?: number
                        layout_config?: Array<ScrollListLayoutConfigOptions>
                        layout_config_count?: number
                        ratio_flag?: boolean
                        system_focus_normal_color?: number
                        system_focus_normal_alpha?: number
                        item_common_focus?: boolean
                        layout?: Record<string, unknown>
                      };
            type ScrollListDataTypeConfigOptions = {
                        start: number
                        end: number
                        type_id: number
                      };
            type ScrollListOptions = extendsBase<
                        {
                          attrs: {
                            x: number
                            y: number
                            w: number
                            h: number
                            item_space?: number
                            item_config: Array<ScrollListItemConfigOptions>
                            item_config_count: number
                            data_array: Array<ScrollListDataItemOptions>
                            data_count: number
                            item_click_func?: IHmUIEventListener
                            data_type_config?: Array<ScrollListDataTypeConfigOptions>
                            data_type_config_count?: number
                            on_page?: number
                            snap_to_center?: boolean
                            item_focus_change_func?: IHmUIEventListener
                            item_enable_horizon_drag?: boolean
                            item_drag_max_distance?: number
                            snap_type?: number
                            item_common_focus?: boolean
                            item_key_focus_change_func?: IHmUIEventListener
                            enable_scroll_bar?: boolean
                            view_index?: number
                            pos_y?: number
                            system_focus_style?: boolean
                            system_focus_width?: number
                            auto_rtl?: boolean
                            focus_over_func?: IHmUIEventListener
                          }
                          styles: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface ScrollListWidget extends IHmUIWidget {
                name: string;
            }

            type SlideSwitchOptions = extendsBase<
                        {
                          attrs: {
                            checked?: boolean
                            select_bg: string
                            unselect_bg: string
                            slide_src: string
                          }
                          styles: IHmUIWidgetBasicOptions & {
                            slide_select_x: number
                            slide_un_select_x: number

                            slide_y?: number
                          }
                          on?: {
                            checked_change_func?: IHmUIEventListener
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface SlideSwitchWidget extends IHmUIWidget {
                name: string;
            }

            type CycleImageTextListDataItemOptions = {
                        src?: string
                        text: string
                      };
            type CycleImageListOptions = extendsBase<
                        {
                          attrs: {
                            data_array: Array<string>
                            data_size: number
                            item_bg_color?: number
                            item_height: number
                            item_click_func?: IHmUIEventListener
                            item_focus_change_func?: IHmUIEventListener
                          }
                          styles: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface CycleImageListWidget extends IHmUIWidget {
                name: string;
            }

            type CycleListOptions = extendsBase<
                        {
                          attrs: {
                            data_array: Array<CycleImageTextListDataItemOptions>
                            data_size: number
                            item_bg_color: number
                            item_height: number
                            item_text_color: number
                            item_text_size: number
                            item_text_x: number
                            item_text_y: number
                            item_text_width?: number
                            item_text_height?: number
                            item_text_align_h?: IHmUIAlign
                            item_text_align_v?: IHmUIAlign
                            item_image_x?: number
                            item_image_y?: number
                            item_click_func?: IHmUIEventListener
                            item_focus_change_func?: IHmUIEventListener
                          }
                          styles: IHmUIWidgetBasicOptions
                        },
                        IHmUIWidgetOptions
                      >;

            interface CycleListWidget extends IHmUIWidget {
                name: string;
            }

            type PointerOptions = extendsBase<
                        {
                          attrs: {
                            angle?: number
                            src: string
                          }
                          styles: {
                            x: number
                            y: number
                            center_x: number
                            center_y: number
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface PointerWidget extends IHmUIWidget {
                name: string;
            }

            type TextImgOptions = extendsBase<
                        {
                          attrs: {
                            font_array: Array<string>
                            type?: number
                            text?: string
                            unit_sc?: string
                            unit_src?: string
                            unit_en?: string
                            unit_tc?: string
                            imperial_unit_sc?: string
                            imperial_unit_en?: string
                            imperial_unit_tc?: string
                            negative_image?: string
                            dot_image?: string
                          }
                          styles: {
                            x: number
                            y: number
                            h_space?: number
                            align_h?: IHmUIAlign
                          }
                        },
                        IHmUIWidgetOptions
                      >;

            interface TextImgWidget extends IHmUIWidget {
                name: string;
            }

            interface HmUITagWidgetMap {
                group: [GroupWidgetOptions, GroupWidget];
                buttonGroup: [ButtonGroupWidgetOptions, ButtonGroupWidget];
                variantButton: [VariantButtonWidgetOptions, VariantButtonWidget];
                groupView: [GroupViewWidgetOptions, GroupViewWidget];
                canvas: [CanvasWidgetOptions, CanvasWidget];
                viewContainer: [ViewContainerWidgetOptions, ViewContainerWidget];
                virtualContainer: [VirtualContainerWidgetOptions, VirtualContainerWidget];
                pageIndicator: [PageIndicatorWidgetOptions, PageIndicatorWidget];
                pageScrollbar: [PageScrollbarWidgetOptions, PageScrollbarWidget];
                widgetPicker: [WidgetPickerWidgetOptions, WidgetPickerWidget];
                sportData: [SportDataWidgetOptions, SportDataWidget];
                checkboxGroup: [CheckBoxGroupWidgetOptions, CheckBoxGroupWidget];
                checkbox: [CheckBoxWidgetOptions, CheckBoxWidget];
                radioGroup: [RadioGroupWidgetOptions, RadioGroupWidget];
                radio: [RadioWidgetOptions, RadioWidget];
                text: [TextWidgetOptions, TextWidget];
                image: [ImageWidgetOptions, ImageWidget];
                button: [ButtonWidgetOptions, ButtonWidget];
                lineProgress: [LineProgressWidgetOptions, LineProgressWidget];
                imgText: [ImageWidgetOptions, ImgTextWidget];
                arcProgress: [ArcProgressWidgetOptions, ArcProgressWidget];
                imgProgress: [ImgProgressWidgetOptions, ImgProgressWidget];
                imgProgressLevel: [ImgProgressLevelWidgetOptions, ImgProgressLevelWidget];
                imgArcProgress: [ImgArcProgressWidgetOptions, ImgArcProgressWidget];
                imgAnimation: [ImgAnimationWidgetOptions, ImgAnimationWidget];
                scrollList: [ScrollListOptions, ScrollListWidget];
                slideSwitch: [SlideSwitchOptions, SlideSwitchWidget];
                cycleImageList: [CycleImageListOptions, CycleImageListWidget];
                cycleList: [CycleListOptions, CycleListWidget];
                pointer: [PointerOptions, PointerWidget];
                textImg: [TextImgOptions, TextImgWidget];
                qrcode: [QrcodeWidgetOptions, QrcodeWidget];
                strokeRect: [StrokeRectWidgetOptions, StrokeRectWidget];
                arc: [ArcWidgetOptions, ArcWidget];
                fillRect: [FillRectWidgetOptions, FillRectWidget];
                circle: [CircleWidgetOptions, CircleWidget];
                dialog: [DialogWidgetOptions, DialogWidget];
            }

            type IWidgetFactory = {
                        [k in keyof HmUITagWidgetMap]: (opts: HmUITagWidgetMap[k][0]) => HmUITagWidgetMap[k][1]
                      };
        }
    }
}


  
  interface IHmElement {}

  type PublicWidgetTypeToken<T extends string> = number & { readonly __widgetType?: T }
  type PublicPropTypeToken<T extends string> = number & { readonly __propType?: T }

  type PublicWidgetType = HmWearableProgram.DeviceSide.HmUI.IHmUIWidgetType & {
    readonly ARC: PublicWidgetTypeToken<'ARC'>
    readonly ARC_PROGRESS: PublicWidgetTypeToken<'ARC_PROGRESS'>
    readonly BUTTON: PublicWidgetTypeToken<'BUTTON'>
    readonly BUTTON_GROUP: PublicWidgetTypeToken<'BUTTON_GROUP'>
    readonly CANVAS: PublicWidgetTypeToken<'CANVAS'>
    readonly CHECKBOX_GROUP: PublicWidgetTypeToken<'CHECKBOX_GROUP'>
    readonly CIRCLE: PublicWidgetTypeToken<'CIRCLE'>
    readonly CYCLE_IMAGE_TEXT_LIST: PublicWidgetTypeToken<'CYCLE_IMAGE_TEXT_LIST'>
    readonly CYCLE_LIST: PublicWidgetTypeToken<'CYCLE_LIST'>
    readonly DIALOG: PublicWidgetTypeToken<'DIALOG'>
    readonly FILL_RECT: PublicWidgetTypeToken<'FILL_RECT'>
    readonly GROUP: PublicWidgetTypeToken<'GROUP'>
    readonly GROUP_VIEW: PublicWidgetTypeToken<'GROUP_VIEW'>
    readonly IMG: PublicWidgetTypeToken<'IMG'>
    readonly IMG_ANIM: PublicWidgetTypeToken<'IMG_ANIM'>
    readonly IMG_ARC_PROGRESS: PublicWidgetTypeToken<'IMG_ARC_PROGRESS'>
    readonly IMG_GROUP: PublicWidgetTypeToken<'IMG_GROUP'>
    readonly IMG_LEVEL: PublicWidgetTypeToken<'IMG_LEVEL'>
    readonly IMG_PROGRESS: PublicWidgetTypeToken<'IMG_PROGRESS'>
    readonly KEYBOARD: PublicWidgetTypeToken<'KEYBOARD'>
    readonly LINE_PROGRESS: PublicWidgetTypeToken<'LINE_PROGRESS'>
    readonly PAGE_INDICATOR: PublicWidgetTypeToken<'PAGE_INDICATOR'>
    readonly PAGE_SCROLLBAR: PublicWidgetTypeToken<'PAGE_SCROLLBAR'>
    readonly QRCODE: PublicWidgetTypeToken<'QRCODE'>
    readonly RADIO_GROUP: PublicWidgetTypeToken<'RADIO_GROUP'>
    readonly SCROLL_LIST: PublicWidgetTypeToken<'SCROLL_LIST'>
    readonly SLIDE_SWITCH: PublicWidgetTypeToken<'SLIDE_SWITCH'>
    readonly SPORT_DATA: PublicWidgetTypeToken<'SPORT_DATA'>
    readonly STROKE_RECT: PublicWidgetTypeToken<'STROKE_RECT'>
    readonly TEXT: PublicWidgetTypeToken<'TEXT'>
    readonly TEXT_IMG: PublicWidgetTypeToken<'TEXT_IMG'>
    readonly TIME_PICKER: PublicWidgetTypeToken<'TIME_PICKER'>
    readonly VARIANT_BUTTON: PublicWidgetTypeToken<'VARIANT_BUTTON'>
    readonly VIEW_CONTAINER: PublicWidgetTypeToken<'VIEW_CONTAINER'>
    readonly VIRTUAL_CONTAINER: PublicWidgetTypeToken<'VIRTUAL_CONTAINER'>
    readonly WIDGET_PICKER: PublicWidgetTypeToken<'WIDGET_PICKER'>
  }

  type UnbrandedWidgetType = HmWearableProgram.DeviceSide.HmUI.HmUIWidgetType & {
    readonly __widgetType?: never
  }

  type PublicPropType = HmWearableProgram.DeviceSide.HmUI.IHmUIPropertyType & {
    readonly MORE: PublicPropTypeToken<'MORE'>
  }

  type PublicHmUIWidget = Omit<
    Pick<HmWearableProgram.DeviceSide.HmUI.IHmUIWidget,
      | 'setAlpha'
      | 'setColor'
      | 'setEnable'
      | 'setProperties'
      | 'getProperties'
      | 'visible'
      | 'x'
      | 'y'
      | 'w'
      | 'h'
      | 'getId'
      | 'getType'
      | 'getProperty'
      | 'addEventListener'
      | 'removeEventListener'
    >,
    'setProperty'
  > & {
    setProperty(
      prop: PublicPropType['MORE'],
      val: Record<string, unknown>,
    ): boolean
  }

  type HmUIBaseCreateWidgetOptions = {
  id?: string
  dataset?: string
  parent?: HmWearableProgram.DeviceSide.HmUI.IHmUIWidget
  layout?: HmWearableProgram.DeviceSide.HmUI.ILayoutStyle
  enable?: boolean
}

  type HmUIArcCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  end_angle?: number
  h?: number
  id?: string
  line_width?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  start_angle?: number
  w?: number
  x?: number
  y?: number
}

  type HmUIArcProgressCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  center_x: number
  center_y: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  color: number
  dataset?: string
  end_angle: number
  h?: number
  id?: string
  level?: number
  line_width: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  radius: number
  src_bg?: string
  start_angle: number
  w?: number
  x?: number
  y?: number
}

  type HmUIButtonCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  align_v?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  color?: number
  dataset?: string
  font?: string
  h: number
  id?: string
  longpress_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  normal_color?: number
  normal_src?: string
  press_color?: number
  press_src?: string
  radius?: number
  text: string
  text_size?: number
  text_w?: number
  w: number
  x: number
  y: number
}

  type HmUIButtonGroupCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  enable?: boolean
  floating?: boolean
  focusChange?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  focusEnd?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  focusLoop?: boolean
  focusOver?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  h: number
  id?: string
  maxBtnCnt?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  scrollEnable?: boolean
  target?: HmWearableProgram.DeviceSide.HmUI.IHmUIWidget
  w: number
  x: number
  y: number
  zIndex?: number
}

  type HmUICanvasCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  alpha?: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  cntr_coord_style?: boolean
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w?: number
  x?: number
  y?: number
}

  type HmUICheckboxGroupCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  check_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  select_src: string
  unselect_src: string
  w: number
  x: number
  y: number
}

  type HmUICircleCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  alpha?: number
  center_x: number
  center_y: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  color: number
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  radius: number
  w?: number
  x?: number
  y?: number
}

  type HmUICycleImageTextListCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  data_array: Array<HmWearableProgram.DeviceSide.HmUI.CycleImageTextListDataItemOptions>
  data_size: number
  dataset?: string
  h: number
  id?: string
  item_bg_color: number
  item_click_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_focus_change_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_height: number
  item_image_x?: number
  item_image_y?: number
  item_text_align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  item_text_align_v?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  item_text_color: number
  item_text_height?: number
  item_text_size: number
  item_text_width?: number
  item_text_x: number
  item_text_y: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w: number
  x: number
  y: number
}

  type HmUICycleListCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  data_array: Array<string>
  data_size: number
  dataset?: string
  h: number
  id?: string
  item_bg_color?: number
  item_click_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_focus_change_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_height: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w: number
  x: number
  y: number
}

  type HmUIDialogCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  cancel_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  cancel_normal_color?: number
  cancel_normal_src?: string
  cancel_press_color?: number
  cancel_press_src?: string
  cancel_text?: string
  cancel_text_color?: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  content_bg_color?: number
  content_text_align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  content_text_align_v?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  content_text_color?: number
  content_text_size?: number
  dataset?: string
  dialog_align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  dialog_align_v?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  ok_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  ok_normal_color?: number
  ok_normal_src?: string
  ok_press_color?: number
  ok_press_src?: string
  ok_text?: string
  ok_text_color?: number
  text: string
  w?: number
  x?: number
  y?: number
}

  type HmUIFillRectCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  angle: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  color: number
  dataset?: string
  h: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  radius: number
  w: number
  x: number
  y: number
}

  type HmUIGroupCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w?: number
  x?: number
  y?: number
}

  type HmUIGroupViewCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  btnClickFunc?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  count: number
  dataset?: string
  focusLoop?: boolean
  h: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  target?: HmWearableProgram.DeviceSide.HmUI.IHmUIWidget
  w: number
  x: number
  y: number
}

  type HmUIImgCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  alpha?: number
  angle?: number
  auto_scale?: boolean
  auto_scale_obj_fit?: boolean
  center_x?: number
  center_y?: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  pos_x?: number
  pos_y?: number
  src?: string
  w?: number
  x?: number
  y?: number
}

  type HmUIImgAnimCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  anim_complete_call: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  anim_ext: string
  anim_fps: number
  anim_path: string
  anim_prefix: string
  anim_size: number
  anim_status: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  repeat_count: number
  w?: number
  x: number
  y: number
}

  type HmUIImgArcProgressCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  arc_type: number
  center_x: number
  center_y: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  end_angle: number
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  pos_x?: number
  pos_y?: number
  radius: number
  src: string
  start_angle: number
  w?: number
  x?: number
  y?: number
}

  type HmUIImgGroupCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  image_array: Array<string>
  image_length?: number
  mode?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  show_level?: number
  src?: string
  w?: number
  x?: number
  y?: number
}

  type HmUIImgLevelCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  image_array: Array<string>
  image_length: number
  level?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  shortcut?: boolean
  type?: number
  w?: number
  x?: number
  y?: number
}

  type HmUIImgProgressCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  image_array: Array<string>
  image_length: number
  level?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w?: number
  x?: number
  y?: number
}

  type HmUIKeyboardCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_func: (keyboard: HmWearableProgram.DeviceSide.HmUI.KeyboardWidget, id: number, value: number | string, mode: number) => void
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  key_attr: HmWearableProgram.DeviceSide.HmUI.KeyboardKeyAttr[]
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w?: number
  x?: number
  y?: number
}

  type HmUILineProgressCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  progress?: number
  progress_fill: {
              alpha?: number
              radius?: number
              color?: number
            }
  track_fill?: {
              alpha?: number
              radius?: number
              color?: number
            }
  type?: number
  w: number
  x: number
  y: number
}

  type HmUIPageIndicatorCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  element_height?: number
  element_radius?: number
  h?: number
  h_space?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  select_color?: number
  select_src: string
  unselect_color?: number
  unselect_src: string
  use_color?: boolean
  v_space?: number
  w?: number
  x?: number
  y?: number
}

  type HmUIPageScrollbarCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  target?: HmWearableProgram.DeviceSide.HmUI.IHmUIWidget
  w?: number
  x?: number
  y?: number
}

  type HmUIQrcodeCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  bg_h?: number
  bg_radius?: number
  bg_w?: number
  bg_x?: number
  bg_y?: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  content: string
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w?: number
  x?: number
  y?: number
}

  type HmUIRadioGroupCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  check_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  select_src: string
  unselect_src: string
  w: number
  x: number
  y: number
}

  type HmUIScrollListCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  auto_rtl?: boolean
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  data_array: Array<HmWearableProgram.DeviceSide.HmUI.ScrollListDataItemOptions>
  data_count: number
  data_type_config?: Array<HmWearableProgram.DeviceSide.HmUI.ScrollListDataTypeConfigOptions>
  data_type_config_count?: number
  dataset?: string
  enable_scroll_bar?: boolean
  focus_over_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  h: number
  id?: string
  item_click_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_common_focus?: boolean
  item_config: Array<HmWearableProgram.DeviceSide.HmUI.ScrollListItemConfigOptions>
  item_config_count: number
  item_drag_max_distance?: number
  item_enable_horizon_drag?: boolean
  item_focus_change_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_key_focus_change_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  item_space?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  on_page?: number
  pos_y?: number
  snap_to_center?: boolean
  snap_type?: number
  system_focus_style?: boolean
  system_focus_width?: number
  view_index?: number
  w: number
  x: number
  y: number
}

  type HmUISlideSwitchCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  checked?: boolean
  checked_change_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  select_bg: string
  slide_select_x: number
  slide_src: string
  slide_un_select_x: number
  slide_y?: number
  unselect_bg: string
  w: number
  x: number
  y: number
}

  type HmUISportDataCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  category: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  count?: number
  dataset?: string
  default_type: number
  edit_id: number
  h?: number
  id?: string
  line_color?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  optional_types?: number[]
  rect_visible?: boolean
  sub_text_color?: number
  sub_text_h?: number
  sub_text_size?: number
  sub_text_visible?: boolean
  sub_text_w?: number
  sub_text_x?: number
  sub_text_y?: number
  text_color?: number
  text_h?: number
  text_size?: number
  text_w?: number
  text_x?: number
  text_y?: number
  w?: number
  x?: number
  y?: number
}

  type HmUIStrokeRectCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  angle: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  color: number
  dataset?: string
  h: number
  id: string
  line_width: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  radius: number
  w: number
  x: number
  y: number
}

  type HmUITextCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  align_v?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  alpha?: number
  char_space?: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  color?: number
  dataset?: string
  end_angle?: number
  font?: string
  h?: number
  id?: string
  line_space?: number
  mode?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  radius?: number
  start_angle?: number
  text?: string
  text_i18n?: Record<string, string>
  text_size?: number
  text_style?: HmWearableProgram.DeviceSide.HmUI.IHmUIWrapTextStyle[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIWrapTextStyle]
  w?: number
  x?: number
  y?: number
}

  type HmUITextImgCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  align_h?: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign[keyof HmWearableProgram.DeviceSide.HmUI.IHmUIAlign]
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  dot_image?: string
  font_array: Array<string>
  h?: number
  h_space?: number
  id?: string
  imperial_unit_en?: string
  imperial_unit_sc?: string
  imperial_unit_tc?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  negative_image?: string
  text?: string
  type?: number
  unit_en?: string
  unit_sc?: string
  unit_src?: string
  unit_tc?: string
  w?: number
  x: number
  y: number
}

  type HmUITimePickerCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  done_icon?: string
  endYear?: number
  font_size: number
  h?: number
  id?: string
  initDay?: number
  initHour?: number
  initMin?: number
  initMonth?: number
  initYear?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  picker_cb?: (picker: HmWearableProgram.DeviceSide.HmUI.TimePickerWidget, event_type: number, column: number, value_index: number) => void
  select_font_size: number
  startYear?: number
  style: 1
  title?: string
  type: 0 | 1
  w?: number
  x?: number
  y?: number
}

  type HmUIVariantButtonCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  backImage?: string
  backVisible?: boolean
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_func?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h: number
  id?: string
  imageH?: number
  imageW?: number
  index?: number
  leftFocus?: boolean
  leftImage?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  rightFocus?: boolean
  rightImage?: string
  selectImage?: string
  selVisible?: boolean
  src?: string
  subText?: string
  systemStyle?: boolean
  text?: string
  type: number
  w: number
  x: number
  y: number
}

  type HmUIViewContainerCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  bounce?: number
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  horizontal?: boolean
  id?: string
  modal?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  page?: number
  pos_x?: number
  pos_y?: number
  scroll_complete_func?: (info: HmWearableProgram.DeviceSide.HmUI.ViewContainerScrollInfo) => void
  scroll_enable?: number
  scroll_frame_func?: (info: HmWearableProgram.DeviceSide.HmUI.ViewContainerScrollInfo) => void
  w?: number
  x?: number
  y?: number
  z_index?: number
}

  type HmUIVirtualContainerCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  dataset?: string
  h?: number
  id?: string
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  w?: number
  x?: number
  y?: number
}

  type HmUIWidgetPickerCreateWidgetOptions = HmUIBaseCreateWidgetOptions & {
  click_down?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  click_up?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  data_config: HmWearableProgram.DeviceSide.HmUI.WidgetPickerColumnConfig[]
  dataset?: string
  done_icon?: string
  h?: number
  id?: string
  init_col_index?: number
  move?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_in?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  move_out?: HmWearableProgram.DeviceSide.HmUI.IHmUIEventListener
  nb_of_columns: number
  normal_color?: number
  picker_cb?: (picker: HmWearableProgram.DeviceSide.HmUI.WidgetPickerWidget, event_type: number, column: number, value_index: number) => void
  select_color?: number
  subtitle?: string
  title?: string
  w?: number
  x?: number
  y?: number
}

  type PublicArcWidget = PublicHmUIWidget

  type PublicArcProgressWidget = PublicHmUIWidget

  type PublicButtonWidget = PublicHmUIWidget

  type PublicButtonGroupWidget = PublicHmUIWidget &
  Pick<HmWearableProgram.DeviceSide.HmUI.ButtonGroupWidget,
    | 'init'
  >

  type PublicCanvasWidget = PublicHmUIWidget &
  Pick<HmWearableProgram.DeviceSide.HmUI.CanvasWidget,
    | 'addEventListener'
    | 'clear'
    | 'drawArc'
    | 'drawCircle'
    | 'drawEllipse'
    | 'drawImage'
    | 'drawLine'
    | 'drawPixel'
    | 'drawPoly'
    | 'drawRect'
    | 'drawText'
    | 'setPaint'
    | 'strokeArc'
    | 'strokeCircle'
    | 'strokeEllipse'
    | 'strokePoly'
    | 'transform'
  >

  type PublicCheckBoxGroupWidget = PublicHmUIWidget

  type PublicCircleWidget = PublicHmUIWidget

  type PublicCycleListWidget = PublicHmUIWidget

  type PublicCycleImageListWidget = PublicHmUIWidget

  type PublicDialogWidget = PublicHmUIWidget

  type PublicFillRectWidget = PublicHmUIWidget

  type PublicGroupWidget = PublicHmUIWidget

  type PublicGroupViewWidget = PublicHmUIWidget &
  Pick<HmWearableProgram.DeviceSide.HmUI.GroupViewWidget,
    | 'addGroup'
    | 'addLine'
    | 'addPslIconButton'
    | 'addPslImageCapButton'
    | 'addPslNormalCapButton'
    | 'createLine'
    | 'init'
    | 'relayout'
    | 'setDirty'
    | 'setItemIsButton'
    | 'setItemTopMargin'
    | 'setItemToView'
    | 'setItemVisible'
  >

  type PublicImageWidget = PublicHmUIWidget

  type PublicImgAnimationWidget = PublicHmUIWidget

  type PublicImgArcProgressWidget = PublicHmUIWidget

  type PublicImgGroupWidget = PublicHmUIWidget

  type PublicImgProgressLevelWidget = PublicHmUIWidget

  type PublicImgProgressWidget = PublicHmUIWidget

  type PublicKeyboardWidget = PublicHmUIWidget

  type PublicLineProgressWidget = PublicHmUIWidget

  type PublicPageIndicatorWidget = PublicHmUIWidget

  type PublicPageScrollbarWidget = PublicHmUIWidget

  type PublicQrcodeWidget = PublicHmUIWidget

  type PublicRadioGroupWidget = PublicHmUIWidget

  type PublicScrollListWidget = PublicHmUIWidget

  type PublicSlideSwitchWidget = PublicHmUIWidget

  type PublicSportDataWidget = PublicHmUIWidget

  type PublicStrokeRectWidget = PublicHmUIWidget

  type PublicTextWidget = PublicHmUIWidget &
  Pick<HmWearableProgram.DeviceSide.HmUI.TextWidget,
    | 'deleteCharacter'
    | 'enableCursor'
    | 'getCursorHeight'
    | 'getCursorIndex'
    | 'getCursorPos'
    | 'getLineHeight'
    | 'getTextCount'
    | 'insertString'
    | 'setTextOutline'
  >

  type PublicTextImgWidget = PublicHmUIWidget

  type PublicTimePickerWidget = PublicHmUIWidget

  type PublicVariantButtonWidget = PublicHmUIWidget

  type PublicViewContainerWidget = PublicHmUIWidget

  type PublicVirtualContainerWidget = PublicHmUIWidget

  type PublicWidgetPickerWidget = PublicHmUIWidget

  interface CreateWidget {
    (
      widgetType: PublicWidgetType['ARC'],
      options: HmUIArcCreateWidgetOptions,
    ): PublicArcWidget
    (
      widgetType: PublicWidgetType['ARC_PROGRESS'],
      options: HmUIArcProgressCreateWidgetOptions,
    ): PublicArcProgressWidget
    (
      widgetType: PublicWidgetType['BUTTON'],
      options: HmUIButtonCreateWidgetOptions,
    ): PublicButtonWidget
    (
      widgetType: PublicWidgetType['BUTTON_GROUP'],
      options: HmUIButtonGroupCreateWidgetOptions,
    ): PublicButtonGroupWidget
    (
      widgetType: PublicWidgetType['CANVAS'],
      options: HmUICanvasCreateWidgetOptions,
    ): PublicCanvasWidget
    (
      widgetType: PublicWidgetType['CHECKBOX_GROUP'],
      options: HmUICheckboxGroupCreateWidgetOptions,
    ): PublicCheckBoxGroupWidget
    (
      widgetType: PublicWidgetType['CIRCLE'],
      options: HmUICircleCreateWidgetOptions,
    ): PublicCircleWidget
    (
      widgetType: PublicWidgetType['CYCLE_IMAGE_TEXT_LIST'],
      options: HmUICycleImageTextListCreateWidgetOptions,
    ): PublicCycleListWidget
    (
      widgetType: PublicWidgetType['CYCLE_LIST'],
      options: HmUICycleListCreateWidgetOptions,
    ): PublicCycleImageListWidget
    (
      widgetType: PublicWidgetType['DIALOG'],
      options: HmUIDialogCreateWidgetOptions,
    ): PublicDialogWidget
    (
      widgetType: PublicWidgetType['FILL_RECT'],
      options: HmUIFillRectCreateWidgetOptions,
    ): PublicFillRectWidget
    (
      widgetType: PublicWidgetType['GROUP'],
      options: HmUIGroupCreateWidgetOptions,
    ): PublicGroupWidget
    (
      widgetType: PublicWidgetType['GROUP_VIEW'],
      options: HmUIGroupViewCreateWidgetOptions,
    ): PublicGroupViewWidget
    (
      widgetType: PublicWidgetType['IMG'],
      options: HmUIImgCreateWidgetOptions,
    ): PublicImageWidget
    (
      widgetType: PublicWidgetType['IMG_ANIM'],
      options: HmUIImgAnimCreateWidgetOptions,
    ): PublicImgAnimationWidget
    (
      widgetType: PublicWidgetType['IMG_ARC_PROGRESS'],
      options: HmUIImgArcProgressCreateWidgetOptions,
    ): PublicImgArcProgressWidget
    (
      widgetType: PublicWidgetType['IMG_GROUP'],
      options: HmUIImgGroupCreateWidgetOptions,
    ): PublicImgGroupWidget
    (
      widgetType: PublicWidgetType['IMG_LEVEL'],
      options: HmUIImgLevelCreateWidgetOptions,
    ): PublicImgProgressLevelWidget
    (
      widgetType: PublicWidgetType['IMG_PROGRESS'],
      options: HmUIImgProgressCreateWidgetOptions,
    ): PublicImgProgressWidget
    (
      widgetType: PublicWidgetType['KEYBOARD'],
      options: HmUIKeyboardCreateWidgetOptions,
    ): PublicKeyboardWidget
    (
      widgetType: PublicWidgetType['LINE_PROGRESS'],
      options: HmUILineProgressCreateWidgetOptions,
    ): PublicLineProgressWidget
    (
      widgetType: PublicWidgetType['PAGE_INDICATOR'],
      options: HmUIPageIndicatorCreateWidgetOptions,
    ): PublicPageIndicatorWidget
    (
      widgetType: PublicWidgetType['PAGE_SCROLLBAR'],
      options: HmUIPageScrollbarCreateWidgetOptions,
    ): PublicPageScrollbarWidget
    (
      widgetType: PublicWidgetType['QRCODE'],
      options: HmUIQrcodeCreateWidgetOptions,
    ): PublicQrcodeWidget
    (
      widgetType: PublicWidgetType['RADIO_GROUP'],
      options: HmUIRadioGroupCreateWidgetOptions,
    ): PublicRadioGroupWidget
    (
      widgetType: PublicWidgetType['SCROLL_LIST'],
      options: HmUIScrollListCreateWidgetOptions,
    ): PublicScrollListWidget
    (
      widgetType: PublicWidgetType['SLIDE_SWITCH'],
      options: HmUISlideSwitchCreateWidgetOptions,
    ): PublicSlideSwitchWidget
    (
      widgetType: PublicWidgetType['SPORT_DATA'],
      options: HmUISportDataCreateWidgetOptions,
    ): PublicSportDataWidget
    (
      widgetType: PublicWidgetType['STROKE_RECT'],
      options: HmUIStrokeRectCreateWidgetOptions,
    ): PublicStrokeRectWidget
    (
      widgetType: PublicWidgetType['TEXT'],
      options: HmUITextCreateWidgetOptions,
    ): PublicTextWidget
    (
      widgetType: PublicWidgetType['TEXT_IMG'],
      options: HmUITextImgCreateWidgetOptions,
    ): PublicTextImgWidget
    (
      widgetType: PublicWidgetType['TIME_PICKER'],
      options: HmUITimePickerCreateWidgetOptions,
    ): PublicTimePickerWidget
    (
      widgetType: PublicWidgetType['VARIANT_BUTTON'],
      options: HmUIVariantButtonCreateWidgetOptions,
    ): PublicVariantButtonWidget
    (
      widgetType: PublicWidgetType['VIEW_CONTAINER'],
      options: HmUIViewContainerCreateWidgetOptions,
    ): PublicViewContainerWidget
    (
      widgetType: PublicWidgetType['VIRTUAL_CONTAINER'],
      options: HmUIVirtualContainerCreateWidgetOptions,
    ): PublicVirtualContainerWidget
    (
      widgetType: PublicWidgetType['WIDGET_PICKER'],
      options: HmUIWidgetPickerCreateWidgetOptions,
    ): PublicWidgetPickerWidget
    (
      widgetType: UnbrandedWidgetType,
      options: HmWearableProgram.DeviceSide.HmUI.HmUIWidgetOptions,
    ): PublicHmUIWidget
  }

  const createWidget: CreateWidget
  const widget: PublicWidgetType
  const align: HmWearableProgram.DeviceSide.HmUI.IHmUIAlign
  const prop: PublicPropType
  const text_style: HmWearableProgram.DeviceSide.HmUI.IHmUIWrapTextStyle
  const event: HmWearableProgram.DeviceSide.HmUI.IHmUIEventType
    const arc_type: HmWearableProgram.DeviceSide.HmUI.IHmUIArcType
    const data_type: HmWearableProgram.DeviceSide.HmUI.IHmUIDataType
    const sport_data: HmWearableProgram.DeviceSide.HmUI.IHmUISportDataType
    const edit_widget_group_type: HmWearableProgram.DeviceSide.HmUI.IHmUIEditWidgetGroupType
    const VARIANT_BUTTON: HmWearableProgram.DeviceSide.HmUI.IHmUIVariantButton

  
}

/**
  * @en User
  * @zh 用户
  */
declare module '@zos/user' {

  /**
   * @en Male
   * @zh 男性
   */
  const GENDER_MALE: number
  /**
   * @en Female
   * @zh 女性
   */
  const GENDER_FEMALE: number
  /**
   * @en User not specified
   * @zh 用户未指定
   */
  const GENDER_UNSPECIFIED: number
  namespace getProfile {
    /**
     * @output
     */
    interface Result {
      /**
       * @en User age, `0` if no data
       * @zh 用户年龄，无数据时为 `0`
       */
      age: number
      /**
       * @en User height, `0` if no data
       * @zh 用户身高，无数据时为 `0`
       */
      height: number
      /**
       * @en User weight, `0` if no data
       * @zh 用户体重，无数据时为 `0`
       */
      weight: number
      /**
       * @en User gender, value refer to user gender constants
       * @zh 用户性别，值参考用户性别常量
       */
      gender: number
      /**
       * @en User's nickname
       * @zh 用户昵称
       */
      nickName: string
      /**
       * @en ISO code of the country or region where the user account is registered
       * @zh 用户账号注册国家/地区 ISO 代码
       */
      region: string
    }
  }

  /**
   * @en Get user information
   * @zh 获取用户信息
   * @constants gender
   * @permissionCode data:user.info
   * @example
   * ```js
   * import { getProfile, GENDER_MALE } from '@zos/user'
   *
   * const { age, gender } = getProfile()
   * console.log(age)
   *
   * if (gender === GENDER_MALE) {
   *   console.log('male')
   * }
   * ```
   */
  function getProfile(): getProfile.Result
  namespace addHealthData {
    interface Option {
      /**
       * @en Weight, in g
       * @zh 体重，单位 g
       */
      weight: number
      /**
       * @en 100 times the value of BMI
       * @zh BMI 数值的 100 倍
       */
      bmi: number
    }

    type Result = boolean
  }

  /**
   * @en Set user health data information
   * @zh 设置用户健康数据信息
   * @permissionCode data:user.health
   * @version 3.0
   * @example
   * ```js
   * import { addHealthData } from '@zos/user'
   *
   * addHealthData({
   *   weight: 65,
   *   bmi: 1900
   * })
   * ```
   */
  function addHealthData(option: addHealthData.Option): addHealthData.Result
}

/**
  * @en Utils
  * @zh 工具
  */
declare module '@zos/utils' {

  namespace px {
    /**
     * @en Pixel values based on `designWidth`
     * @zh 以 `designWidth` 为缩放基准的像素值
     */
    type PxValue = number

    /**
     * @en Pixel values after scaling calculation
     * @zh 根据机型实际宽度进行缩放计算后的像素值
     */
    type Result = number
  }

  /**
   * @en Pixel scaling calculation. The `designWidth` of each model in the `targets` object in the `app.json` is used as the base.
   * @zh 以小程序配置 `app.json` 中 `targets` 对象中各机型配置的 `designWidth` 为基准进行像素值缩放计算
   * @example
   * ```js
   * import { px } from '@zos/utils'
   *
   * px(480)
   * ```
   */
  function px(value: px.PxValue): px.Result
  namespace assets {
    /**
     * @en The base path, which will be spliced before the resource file path
     * @zh 基础路径，会拼接在资源文件路径之前
     */
    type BasePath = string

    /**
     * @en Resource file path constructor
     * @zh 资源文件路径构造函数
     */
    type AssetsPathFunc = (path: Path, isRtl?: IsRtl) => ResultPath

    /**
     * @en Resource file path
     * @zh 资源文件路径
     */
    type Path = string

    /**
     * @en Whether to splice the rtl path
     * @zh 是否需要拼接 rtl 路径
     */
    type IsRtl = boolean

    /**
     * @en Final file path
     * @zh 最终文件路径
     */
    type ResultPath = string
  }

  /**
   * @en Used to handle resource file paths, splice `basePath`. and can pass in parameters for rtl path conversion of images, for RTL adaptation of Mini Program
   * @zh 用于处理资源文件路径，拼接 `basePath`。并可传入参数对图片进行 rtl 路径转换，用于小程序的 RTL 适配
   * @example
   * ```js
   * import { assets } from '@zos/utils'
   *
   * const imagePath = 'zeppos-logo.png'
   * const assetsPathFunc = assets('img')
   *
   * console.log(assetsPathFunc(imagePath)) // img/zeppos-logo.png
   * console.log(assetsPathFunc(imagePath, true)) // img/zeppos-logo@rtl.png
   * ```
   */
  function assets(basePath: assets.BasePath): assets.AssetsPathFunc
  /**
   * @en The `log` instance is used for log printing and has multiple levels of logging methods for easy filtering in the console
   * @zh `log` 实例用于日志打印，有多种等级的日志方法，方便在控制台进行过滤
   * @example
   * ```js
   * import { log } from '@zos/utils'
   *
   * const pageLogger = log.getLogger('page')
   *
   * pageLogger.log('page created')
   * pageLogger.error('page error')
   * ```
   */
  interface log {
    /**
     * @en Returns a new `log` instance with the `name` tag, which is added when the print log method is executed to make it easier to distinguish
     * @zh 返回一个新的 `log` 实例，带有 `name` 标记，在执行打印日志方法时，会加入 `name` 标记，便于区分
     */
    getLogger(name: string): log
    /**
     * @en Print log level logs
     * @zh 打印 log 级别的日志
     */
    log(...args: string[]): void
    /**
     * @en Print warn level logs
     * @zh 打印 warn 级别的日志
     */
    warn(...args: string[]): void
    /**
     * @en Print debug level logs
     * @zh 打印 debug 级别的日志
     */
    debug(...args: string[]): void
    /**
     * @en Print error level logs
     * @zh 打印 error 级别的日志
     */
    error(...args: string[]): void
    /**
     * @en Print info level logs
     * @zh 打印 info 级别的日志
     */
    info(...args: string[]): void
  }

  const log: log
  /**
   * @en EventBus is a utility class that provides event publishing/subscribing, an implementation of the publish-subscribe pattern
   * @zh EventBus 是一个提供事件发布/订阅的工具类，发布-订阅模式的一种实现
   * @example
   * ```js
   * import { EventBus } from '@zos/utils'
   *
   * const eventBus = new EventBus()
   *
   * eventBus.on('data', (data) => {
   *  console.log(data)
   * })
   *
   * eventBus.emit('data', 'Hello Zepp OS!')
   * ```
   */
  class EventBus {
    /**
     * @en Adds the listener function to the end of the listeners array for the event named eventName
     * @zh 为 `eventName` 对应的的监听器数组中添加一个事件监听器
     */
    on(eventName: string, listener: (...args: any[]) => void): void
    /**
     * @en Removes the specified listener from the listener array for the event named eventName
     * @zh 移除 `eventName` 对应的的监听器数组中的一个事件监听器
     */
    off(eventName: string, listener: (...args: any[]) => void): void
    /**
     * @en Triggers the listener functions for the event named eventName
     * @zh 触发 `eventName` 对应的的监听器数组中的所有事件监听器
     */
    emit(eventName: string, ...args: any[]): void
    /**
     * @en Adds a one-time listener function for the event named eventName
     * @zh 为 `eventName` 添加一个仅生效一次的事件监听器
     */
    once(eventName: string, listener: (...args: any[]) => void): void
    /**
     * @en Removes all listeners, or those of the specified eventName
     * @zh 移除所有事件监听器
     */
    clear(): void
    /**
     * @en Gets the number of registered event listeners corresponding to `eventName`. If `eventName` is not passed, get the number of registered `eventName` types
     * @zh 获取对应 `eventName` 对应的注册事件监听器的数量。不传递 `eventName` 则获取所注册 `eventName` 种类的数量
     */
    count(eventName?: string): number
  }
  namespace stringToBuffer {
    /**
     * @en The string to be converted
     * @zh 需要转换的字符串
     */
    type InputString = string

    /**
     * @en The converted `ArrayBuffer`
     * @zh 转换后的 `ArrayBuffer`
     */
    type Result = ArrayBuffer
  }

  /**
   * @en Convert string type to `ArrayBuffer` type
   * @zh 将字符串类型转换为 `ArrayBuffer` 类型
   * @version 4.0
   * @example
   * ```js
   * import { stringToBuffer } from '@zos/utils'
   *
   * const buffer = stringToBuffer('Hello Zepp OS')
   * ```
   */
  function stringToBuffer(str: stringToBuffer.InputString): stringToBuffer.Result
  namespace bufferToString {
    /**
     * @en The `ArrayBuffer` to be converted
     * @zh 需要转换的 `ArrayBuffer`
     */
    type InputBuffer = ArrayBuffer

    /**
     * @en The converted string
     * @zh 转换后的字符串
     */
    type Result = string
  }

  /**
   * @en Convert `ArrayBuffer` type to string type
   * @zh 将 `ArrayBuffer` 类型转换为字符串类型
   * @version 4.0
   * @example
   * ```js
   * import { bufferToString } from '@zos/utils'
   *
   * const str = bufferToString(buffer)
   * ```
   */
  function bufferToString(buffer: bufferToString.InputBuffer): bufferToString.Result
}
