import { NativeModules } from 'react-native';

export enum CharacteristicProperty {
  Notify = 'notify',
  WriteWithoutResponse = 'writeWithoutResponse',
  Write = 'write',
}

export enum CharacteristicPermission {
  Readable = 'readable',
  ReadEncryptionRequired = 'readEncryptionRequired',
  Writeable = 'writeable',
  WriteEncryptionRequired = 'writeEncryptionRequired',
}

type BluetoothPeripheralType = {
  startAdvertising(): void;
  setServiceUUID(serviceUUID: string): void;
  setDeviceName(deviceName: string): void;
  stopAdvertising(): void;
  addCharacteristic(characteristicUuid: string, properties: CharacteristicProperty[], permissions: CharacteristicPermission[]): void;
};

const { BluetoothPeripheral } = NativeModules;

export default BluetoothPeripheral as BluetoothPeripheralType;
