#import <React/RCTViewManager.h>
#import <React/RCTUIManager.h>
#import "RNZoomWhiteboardView.h"

@interface RNZoomWhiteboardViewManager : RCTViewManager
@end

@implementation RNZoomWhiteboardViewManager

RCT_EXPORT_MODULE(RNZoomWhiteboardView)

- (UIView *)view {
    return [RNZoomWhiteboardView sharedInstance];
}

RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTPointerEvents, RNZoomWhiteboardView)
{
    // Handle pointerEvents prop
    // "box-none" means the view itself doesn't capture touches, but subviews can
    // In iOS, we use userInteractionEnabled to control this
    if (json) {
        RCTPointerEvents pointerEvents = [RCTConvert RCTPointerEvents:json];
        switch (pointerEvents) {
            case RCTPointerEventsNone:
            case RCTPointerEventsBoxNone:
                view.userInteractionEnabled = NO;
                break;
            case RCTPointerEventsUnspecified:
            case RCTPointerEventsBoxOnly:
            default:
                view.userInteractionEnabled = YES;
                break;
        }
    } else {
        view.userInteractionEnabled = YES;
    }
}

@end
