export type ActionType = 'scan' | 'navigate' | 'openDoor' | '/Terminus/Future/Auth/Req' | any

export interface ActionParams {
  actionType: ActionType // 需要宿主进行的操作，例如扫码、跳转、或者授权
  appid?: string // 跳转时，必须传入的目标应用的appid
  targetUrl: string // 宿主执行操作后，要跳转的url，例如跳转到扫码结果页
  data?: any // 传递给主应用的额外参数，例如蓝牙开门时的蓝牙信息
}

export type CallBack = (...data: any[]) => void

export type ScanParams = {
  targetUrl: string
  fail?: CallBack
}

export type NavigateParams = {
  appid: string // 要跳转的目标应用的appid
  targetUrl: string // 要跳转到目标应用的具体页面，默认是'pages/index/index'
}



export type DoorOpenType = 'bluetooth' | 'remote' | 'face_recognition' | 'access_cards' | 'QR_code' | 'SIP'
// 人脸识别:face_recognition 门禁卡:access_cards 蓝牙:bluetooth 远程开门：remote 二维码开门：QR_code 呼叫 :SIP
export interface DoorConfig {
  openType: DoorOpenType // 开门方式，一般是从字典里面查询
  deviceName: string // 设备名
  mac: string // 设备MAC地址,蓝牙开门必传
  password: string // 设备密码,蓝牙开门必传
  deviceId: string // 设备id,远程开门必传
  productId: string // 产品id,远程开门必传
  phone: string // 用户手机号
  [key: string]: any
}

export interface OpenDoorConfig {
  info: DoorConfig
  targetUrl?: string // 开门后跳转回哪个页面，默认是/pages/index/index
}
