//
//  PopupView.h
//  AIIM
//
//  Created by qitewei on 2025/5/29.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, PopupPosition) {
    PopupPositionTop,
    PopupPositionCenter,
    PopupPositionBottom
};

typedef NS_ENUM(NSInteger, PopupAnimationType) {
    PopupAnimationTypeFromBottom,    // 自下往上
    PopupAnimationTypeFromTop,       // 自上往下
    PopupAnimationTypeFade           // 淡入淡出
};

typedef NS_ENUM(NSInteger, PopupContainerType) {
    PopupContainerTypeView,          // 添加到当前view
    PopupContainerTypeWindow         // 添加到window
};

@interface PopupView : UIView
/// 自定义视图
@property (nonatomic, strong) UIView *customView;

/// 弹窗位置 (默认居中)
@property (nonatomic, assign) PopupPosition position;

/// 动画类型 (默认自下往上)
@property (nonatomic, assign) PopupAnimationType animationType;

/// 点击外部是否关闭 (默认YES)
@property (nonatomic, assign) BOOL dismissOnBackgroundTap;

/// 上下偏移量 (默认0)
@property (nonatomic, assign) CGFloat offset;

/// 显示层级 (默认View)
@property (nonatomic, assign) PopupContainerType containerType;

/// 背景颜色 (默认半透明黑)
@property (nonatomic, strong) UIColor *backgroundColor;

/// 弹窗消失完成回调
@property (nonatomic, copy) void (^dismissCompletion)(void);

/// 显示弹窗
/// @param view 父视图，如果containerType为Window则可为nil
- (void)showInView:(UIView *)view;

/// 隐藏弹窗
- (void)dismiss;

/// 弹窗显示状态
@property (nonatomic, readonly, getter=isShowing) BOOL showing;
@end

NS_ASSUME_NONNULL_END
