import { type Device } from 'react-native-ble-plx'

export interface BleScanInfo {
  rawData?: ArrayBuffer
  rssi: number
  isEnableConnect: boolean
}

export type BleDevice = Device & {
  scanInfo?: BleScanInfo
  connected?: boolean
}

export enum ConnectionState {
  DISCONNECTED = 'disconnected',
  CONNECTING = 'connecting',
  CONNECTED = 'connected',
  DISCONNECTING = 'disconnecting',
}

export interface BleError {
  errorCode: number
  message: string
  attErrorCode?: number | null
  iosErrorCode?: number | null
  androidErrorCode?: number | null
  reason?: string | null
}

export interface ScanResult {
  device: BleDevice
  rssi: number | null
  localName: string | null
}
