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

#import <Foundation/Foundation.h>
#import "IoTTypes.h"

@class IoTMultichannelGroupMainAttr;
@class IoTMultichannelGroupSatelliteAttr;
@class IoTMultichannelVolumeControlAttr;
@class IoTWrappedRepresentation;
@class IoTMultichannelChannelDevice;

NS_ASSUME_NONNULL_BEGIN

typedef void(^IoTMultichannelChanged)(IoTHomeTheaterChannel channel);

typedef NS_ENUM(NSInteger,AttrChannelMapNumber) {
    AttrChannelMapNumberNone = 0,
    AttrChannelMapNumberFrontLeft = 1,
    AttrChannelMapNumberFrontRight = 2,
    AttrChannelMapNumberFrontCenter = 3,
    AttrChannelMapNumberSubwoofer = 4,
    AttrChannelMapNumberSideLeft = 5,
    AttrChannelMapNumberSideRight = 6,
    AttrChannelMapNumberBackLeft = 7,
    AttrChannelMapNumberBackRight = 8,
    AttrChannelMapNumberTopFrontLeft = 9,
    AttrChannelMapNumberTopFrontRight = 10,
    AttrChannelMapNumberTopBackLeft = 11,
    AttrChannelMapNumberTopBackRight = 12,
};

@interface IoTMultichannelState : NSObject

@property (nonatomic, readonly) BOOL isSoundbar;
@property (nonatomic, readonly) BOOL isSatellite;
@property (nonatomic, copy) NSString *playerID;

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithStateSyncQueue:(dispatch_queue_t)syncQueue NS_DESIGNATED_INITIALIZER;

- (void)updateWithMainAttr:(nullable IoTMultichannelGroupMainAttr *)mainAttr
       availabilityChanged:(nullable IoTMultichannelChanged)availabilityChanged
             volumeChanged:(nullable IoTMultichannelChanged)volumeChanged
               changeQueue:(nullable dispatch_queue_t)changeQueue;

- (void)updateWithMainAttrDiff:(IoTWrappedRepresentation *)mainAttrDiff
           availabilityChanged:(nullable IoTMultichannelChanged)availabilityChanged
                 volumeChanged:(nullable IoTMultichannelChanged)volumeChanged
                   changeQueue:(nullable dispatch_queue_t)changeQueue;

- (void)updateWithMCVolumeAttr:(nullable IoTMultichannelVolumeControlAttr *)volumeAttr
                 volumeChanged:(nullable IoTMultichannelChanged)volumeChanged
                   changeQueue:(nullable dispatch_queue_t)changeQueue;

- (void)updateWithMCVolumeAttrDiff:(IoTWrappedRepresentation *)volumeAttrDiff
                     volumeChanged:(nullable IoTMultichannelChanged)volumeChanged
                       changeQueue:(nullable dispatch_queue_t)changeQueue;

- (void)updateWithSatelliteAttr:(nullable IoTMultichannelGroupSatelliteAttr *)satelliteAttr;

- (void)updateWithSatelliteAttrDiff:(IoTWrappedRepresentation *)satelliteAttrDiff;

- (NSArray<NSString *> *)playerIDsForAllChannels;

- (NSArray<NSString *> *)playerIDsForAllChannelsRemovable;

- (NSArray<IoTMultichannelChannelDevice *> *)devicesForChannel:(IoTHomeTheaterChannel)channel;

- (AttrChannelMapNumber)attrChannelMapForHomeTheaterChannel:(IoTHomeTheaterChannel)homeTheaterChannel;

- (IoTHomeTheaterChannel)homeTheaterChannelForAttrChannelMap:(AttrChannelMapNumber)attrChannelMapNumber;

@end

NS_ASSUME_NONNULL_END
