#import <React/RCTViewManager.h>

@interface RCT_EXTERN_MODULE(RichTextEditorViewManager, RCTViewManager)

RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString)
RCT_EXPORT_VIEW_PROPERTY(editable, BOOL)
RCT_EXPORT_VIEW_PROPERTY(maxHeight, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(numberOfLines, NSInteger)
RCT_EXPORT_VIEW_PROPERTY(showToolbar, BOOL)
RCT_EXPORT_VIEW_PROPERTY(toolbarOptions, NSArray)
RCT_EXPORT_VIEW_PROPERTY(initialContentJson, NSString)
RCT_EXPORT_VIEW_PROPERTY(variant, NSString)
RCT_EXPORT_VIEW_PROPERTY(onContentChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onEditorFocus, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onEditorBlur, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onSizeChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onActiveStylesChange, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onLinkTap, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onPasteMedia, RCTDirectEventBlock)

// New properties for CometChat integration
RCT_EXPORT_VIEW_PROPERTY(selection, NSDictionary)
RCT_EXPORT_VIEW_PROPERTY(textStyle, NSDictionary)
RCT_EXPORT_VIEW_PROPERTY(placeholderTextColor, NSString)
RCT_EXPORT_VIEW_PROPERTY(text, NSString)
RCT_EXPORT_VIEW_PROPERTY(toolbarMode, NSString)
RCT_EXPORT_VIEW_PROPERTY(codeBackgroundColor, NSString)
RCT_EXPORT_VIEW_PROPERTY(codeBorderColor, NSString)
RCT_EXPORT_VIEW_PROPERTY(codeTextColor, NSString)
RCT_EXPORT_VIEW_PROPERTY(codeFontSize, NSNumber)
RCT_EXPORT_VIEW_PROPERTY(showTextSelectionMenuItems, BOOL)

RCT_EXTERN_METHOD(setContent:(nonnull NSNumber *)node blocks:(nonnull NSArray *)blocks)
RCT_EXTERN_METHOD(getText:(nonnull NSNumber *)node resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(getBlocks:(nonnull NSNumber *)node resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(clear:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(focus:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(blur:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(insertLink:(nonnull NSNumber *)node url:(nonnull NSString *)url text:(nonnull NSString *)text)
RCT_EXTERN_METHOD(undo:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(redo:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleBold:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleItalic:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleUnderline:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleStrikethrough:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleCode:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleCodeBlock:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(toggleHighlight:(nonnull NSNumber *)node color:(NSString *)color)
RCT_EXTERN_METHOD(setHeading:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setBulletList:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setNumberedList:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setQuote:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setChecklist:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setParagraph:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(clearFormatting:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(indent:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(outdent:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setAlignment:(nonnull NSNumber *)node alignment:(nonnull NSString *)alignment)
RCT_EXTERN_METHOD(toggleChecklistItem:(nonnull NSNumber *)node)
RCT_EXTERN_METHOD(setText:(nonnull NSNumber *)node text:(nonnull NSString *)text)
RCT_EXTERN_METHOD(setSelection:(nonnull NSNumber *)node start:(nonnull NSInteger)start end:(nonnull NSInteger)end)
RCT_EXTERN_METHOD(setMentionRanges:(nonnull NSNumber *)node ranges:(nonnull NSArray *)ranges)
RCT_EXTERN_METHOD(removeLink:(nonnull NSNumber *)node location:(nonnull NSInteger)location length:(nonnull NSInteger)length)
RCT_EXTERN_METHOD(updateLink:(nonnull NSNumber *)node location:(nonnull NSInteger)location length:(nonnull NSInteger)length newUrl:(nonnull NSString *)newUrl newText:(nonnull NSString *)newText)

@end
