//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropinteraction?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIDropInteraction;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIDropInteraction {}
);

#[cfg(feature = "UIInteraction")]
extern_conformance!(
    unsafe impl UIInteraction for UIDropInteraction {}
);

impl UIDropInteraction {
    extern_methods!(
        #[unsafe(method(initWithDelegate:))]
        #[unsafe(method_family = init)]
        pub fn initWithDelegate(
            this: Allocated<Self>,
            delegate: &ProtocolObject<dyn UIDropInteractionDelegate>,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIDropInteractionDelegate>>>;

        #[unsafe(method(allowsSimultaneousDropSessions))]
        #[unsafe(method_family = none)]
        pub fn allowsSimultaneousDropSessions(&self) -> bool;

        /// Setter for [`allowsSimultaneousDropSessions`][Self::allowsSimultaneousDropSessions].
        #[unsafe(method(setAllowsSimultaneousDropSessions:))]
        #[unsafe(method_family = none)]
        pub fn setAllowsSimultaneousDropSessions(&self, allows_simultaneous_drop_sessions: bool);
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropoperation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIDropOperation(pub NSUInteger);
impl UIDropOperation {
    #[doc(alias = "UIDropOperationCancel")]
    pub const Cancel: Self = Self(0);
    #[doc(alias = "UIDropOperationForbidden")]
    pub const Forbidden: Self = Self(1);
    #[doc(alias = "UIDropOperationCopy")]
    pub const Copy: Self = Self(2);
    #[doc(alias = "UIDropOperationMove")]
    pub const Move: Self = Self(3);
}

unsafe impl Encode for UIDropOperation {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UIDropOperation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropproposal?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIDropProposal;
);

extern_conformance!(
    unsafe impl NSCopying for UIDropProposal {}
);

unsafe impl CopyingHelper for UIDropProposal {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for UIDropProposal {}
);

impl UIDropProposal {
    extern_methods!(
        #[unsafe(method(initWithDropOperation:))]
        #[unsafe(method_family = init)]
        pub fn initWithDropOperation(
            this: Allocated<Self>,
            operation: UIDropOperation,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(operation))]
        #[unsafe(method_family = none)]
        pub fn operation(&self) -> UIDropOperation;

        #[unsafe(method(isPrecise))]
        #[unsafe(method_family = none)]
        pub fn isPrecise(&self) -> bool;

        /// Setter for [`isPrecise`][Self::isPrecise].
        #[unsafe(method(setPrecise:))]
        #[unsafe(method_family = none)]
        pub fn setPrecise(&self, precise: bool);

        #[unsafe(method(prefersFullSizePreview))]
        #[unsafe(method_family = none)]
        pub fn prefersFullSizePreview(&self) -> bool;

        /// Setter for [`prefersFullSizePreview`][Self::prefersFullSizePreview].
        #[unsafe(method(setPrefersFullSizePreview:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersFullSizePreview(&self, prefers_full_size_preview: bool);
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropinteractiondelegate?language=objc)
    pub unsafe trait UIDropInteractionDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:canHandleSession:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_canHandleSession(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        ) -> bool;

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:sessionDidEnter:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_sessionDidEnter(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:sessionDidUpdate:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_sessionDidUpdate(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        ) -> Retained<UIDropProposal>;

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:sessionDidExit:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_sessionDidExit(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:performDrop:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_performDrop(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:concludeDrop:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_concludeDrop(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dropInteraction:sessionDidEnd:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_sessionDidEnd(
            &self,
            interaction: &UIDropInteraction,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(all(
            feature = "UIDragItem",
            feature = "UITargetedDragPreview",
            feature = "UITargetedPreview"
        ))]
        #[optional]
        #[unsafe(method(dropInteraction:previewForDroppingItem:withDefault:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_previewForDroppingItem_withDefault(
            &self,
            interaction: &UIDropInteraction,
            item: &UIDragItem,
            default_preview: &UITargetedDragPreview,
        ) -> Option<Retained<UITargetedDragPreview>>;

        #[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
        #[optional]
        #[unsafe(method(dropInteraction:item:willAnimateDropWithAnimator:))]
        #[unsafe(method_family = none)]
        fn dropInteraction_item_willAnimateDropWithAnimator(
            &self,
            interaction: &UIDropInteraction,
            item: &UIDragItem,
            animator: &ProtocolObject<dyn UIDragAnimating>,
        );
    }
);
