#import <React/RCTViewManager.h>
#import <React/RCTBridge.h>
#import <React/RCTUIManager.h>

@interface RCT_EXTERN_MODULE(BBPlayerViewManager, RCTViewManager)

// Props
RCT_EXPORT_VIEW_PROPERTY(jsonUrl, NSString)
RCT_EXPORT_VIEW_PROPERTY(options, NSDictionary)

// Event handlers
RCT_EXPORT_VIEW_PROPERTY(onDidFailWithError, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidRequestCollapse, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidRequestExpand, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidRequestOpenUrl, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidSetupWithJsonUrl, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdError, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdFinished, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdLoaded, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdLoadStart, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdNotFound, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdQuartile1, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdQuartile2, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdQuartile3, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAdStarted, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAllAdsCompleted, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAutoPause, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerAutoPausePlay, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerCanPlay, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerCustomStatistics, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerDurationChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerEnded, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerFullscreen, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerMediaClipFailed, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerMediaClipLoaded, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerModeChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerPause, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerPhaseChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerPlay, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerPlaying, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerProjectLoaded, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerRetractFullscreen, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerSeeked, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerSeeking, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerStall, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerStateChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerViewFinished, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerViewStarted, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerVolumeChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onDidTriggerApiReady, RCTDirectEventBlock)

// Commands (methods callable from JS)
RCT_EXTERN_METHOD(play:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(pause:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(seek:(nonnull NSNumber *)reactTag offsetInSeconds:(nonnull NSNumber *)offsetInSeconds)
RCT_EXTERN_METHOD(seekRelative:(nonnull NSNumber *)reactTag offsetInSeconds:(nonnull NSNumber *)offsetInSeconds)
RCT_EXTERN_METHOD(setMuted:(nonnull NSNumber *)reactTag muted:(BOOL)muted)
RCT_EXTERN_METHOD(setVolume:(nonnull NSNumber *)reactTag volume:(nonnull NSNumber *)volume)
RCT_EXTERN_METHOD(presentModal:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(closeModal:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(enterFullscreen:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(enterFullscreenLandscape:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(exitFullscreen:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(collapse:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(expand:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(autoPlayNextCancel:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(destroy:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(unload:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(showCastPicker:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(loadWithClipId:(nonnull NSNumber *)reactTag clipId:(NSString *)clipId initiator:(NSString *)initiator autoPlay:(BOOL)autoPlay seekTo:(nonnull NSNumber *)seekTo)
RCT_EXTERN_METHOD(loadWithClipListId:(nonnull NSNumber *)reactTag clipListId:(NSString *)clipListId initiator:(NSString *)initiator autoPlay:(BOOL)autoPlay seekTo:(nonnull NSNumber *)seekTo)
RCT_EXTERN_METHOD(loadWithProjectId:(nonnull NSNumber *)reactTag projectId:(NSString *)projectId initiator:(NSString *)initiator autoPlay:(BOOL)autoPlay seekTo:(nonnull NSNumber *)seekTo)
RCT_EXTERN_METHOD(loadWithClipJson:(nonnull NSNumber *)reactTag clipJson:(NSString *)clipJson initiator:(NSString *)initiator autoPlay:(BOOL)autoPlay seekTo:(nonnull NSNumber *)seekTo)
RCT_EXTERN_METHOD(loadWithClipListJson:(nonnull NSNumber *)reactTag clipListJson:(NSString *)clipListJson initiator:(NSString *)initiator autoPlay:(BOOL)autoPlay seekTo:(nonnull NSNumber *)seekTo)
RCT_EXTERN_METHOD(loadWithProjectJson:(nonnull NSNumber *)reactTag projectJson:(NSString *)projectJson initiator:(NSString *)initiator autoPlay:(BOOL)autoPlay seekTo:(nonnull NSNumber *)seekTo)

// Note: loadWithShortsId is NOT supported on BBPlayerView.
// For Shorts playback, use the BBShortsView component instead.

@end
