//
// © 2018-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

#import "IoTDevice.h"
@class IoTSysController;
@class IoTBluetoothDevice;
@class IoTVoiceUIClient;

NS_ASSUME_NONNULL_BEGIN

@protocol IoTDeviceUpdates <NSObject>

- (void)device:(IoTDevice *)device didChangeName:(NSString *)name;
- (void)deviceDidChangeBatteryState:(IoTDevice *)device;

- (void)deviceDidChangeEthernetState:(IoTDevice *)device;
- (void)deviceDidChangeWiFiState:(IoTDevice *)device;
- (void)deviceDidChangeAccessPointState:(IoTDevice *)device;

- (void)device:(IoTDevice *)device btScanDidDiscoverBtDevice:(IoTBluetoothDevice *)btDevice;
- (void)device:(IoTDevice *)device btScanStateDidChange:(BOOL)scanning;
- (void)device:(IoTDevice *)device btAdapterStateDidChange:(IoTBluetoothAdapterState)adapterState;
- (void)device:(IoTDevice *)device btDiscoverabilityDidChange:(IoTDiscoverable)discoverability;
- (void)device:(IoTDevice *)device btDidConnectDevice:(IoTBluetoothDevice *)btDevice;
- (void)device:(IoTDevice *)device btDidDisconnectDevice:(IoTBluetoothDevice *)btDevice;
- (void)device:(IoTDevice *)device btPairedDevicesDidChange:(NSArray<IoTBluetoothDevice *> *)pairedDevices;

- (void)device:(IoTDevice *)device voiceUIClientsDidChange:(NSArray<IoTVoiceUIClient *> *)voiceUIClients;
- (void)device:(IoTDevice *)device voiceUIEnabledStateDidChange:(BOOL)enabled;
- (void)device:(IoTDevice *)device voiceUIDefaultClientDidChange:(nullable IoTVoiceUIClient *)voiceUIClient;
- (void)device:(IoTDevice *)device voiceUIDidProvideAVSAuthenticationCode:(NSString *)code url:(NSString *)url;
- (void)device:(IoTDevice *)device voiceUIOnboardingDidErrorWithTimeout:(BOOL)didTimeout reattempt:(int)reattempt;

- (void)device:(IoTDevice *)device zbAdapterStateDidChange:(IoTZigbeeAdapterState)adapterState;
- (void)device:(IoTDevice *)device zbCoordinatorStateDidChange:(IoTCoordinatorState)coordinatorState;
- (void)device:(IoTDevice *)device zbJoinedDevicesDidChange:(NSArray<IoTZigbeeDevice *> *)joinedDevices;
- (void)device:(IoTDevice *)device zbJoiningStateDidChange:(BOOL)joiningAllowed;

@end

@interface IoTDevice (Private)

@property (nonatomic, weak) id<IoTDeviceUpdates> updatesDelegate;

- (NSString *)host;

- (instancetype)initWithIoTSysController:(IoTSysController *)iotSysController
                          stateSyncQueue:(dispatch_queue_t)syncQueue;

- (void)updateWithCompletion:(nullable void(^)(BOOL))completion
             completionQueue:(nullable dispatch_queue_t)queue;

- (void)replaceIoTSysController:(IoTSysController *)iotSysController;

@end

NS_ASSUME_NONNULL_END
