//! 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 crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdroppable?language=objc)
    #[cfg(all(
        feature = "UIPasteConfigurationSupporting",
        feature = "UITextInput",
        feature = "UITextInputTraits",
        feature = "UITextPasteConfigurationSupporting"
    ))]
    pub unsafe trait UITextDroppable:
        UITextInput + UITextPasteConfigurationSupporting + MainThreadOnly
    {
        #[unsafe(method(textDropDelegate))]
        #[unsafe(method_family = none)]
        fn textDropDelegate(&self) -> Option<Retained<ProtocolObject<dyn UITextDropDelegate>>>;

        /// Setter for [`textDropDelegate`][Self::textDropDelegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setTextDropDelegate:))]
        #[unsafe(method_family = none)]
        fn setTextDropDelegate(
            &self,
            text_drop_delegate: Option<&ProtocolObject<dyn UITextDropDelegate>>,
        );

        #[cfg(feature = "UIDropInteraction")]
        #[unsafe(method(textDropInteraction))]
        #[unsafe(method_family = none)]
        fn textDropInteraction(&self) -> Option<Retained<UIDropInteraction>>;

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdropeditability?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextDropEditability(pub NSUInteger);
impl UITextDropEditability {
    #[doc(alias = "UITextDropEditabilityNo")]
    pub const No: Self = Self(0);
    #[doc(alias = "UITextDropEditabilityTemporary")]
    pub const Temporary: Self = Self(1);
    #[doc(alias = "UITextDropEditabilityYes")]
    pub const Yes: Self = Self(2);
}

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdropdelegate?language=objc)
    pub unsafe trait UITextDropDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:willBecomeEditableForDrop:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_willBecomeEditableForDrop(
            &self,
            text_droppable_view: &UIView,
            drop: &ProtocolObject<dyn UITextDropRequest>,
        ) -> UITextDropEditability;

        #[cfg(all(
            feature = "UIDropInteraction",
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextDropProposal",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:proposalForDrop:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_proposalForDrop(
            &self,
            text_droppable_view: &UIView,
            drop: &ProtocolObject<dyn UITextDropRequest>,
        ) -> Retained<UITextDropProposal>;

        #[cfg(all(
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:willPerformDrop:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_willPerformDrop(
            &self,
            text_droppable_view: &UIView,
            drop: &ProtocolObject<dyn UITextDropRequest>,
        );

        #[cfg(all(
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITargetedDragPreview",
            feature = "UITargetedPreview",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:previewForDroppingAllItemsWithDefault:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_previewForDroppingAllItemsWithDefault(
            &self,
            text_droppable_view: &UIView,
            default_preview: &UITargetedDragPreview,
        ) -> Option<Retained<UITargetedDragPreview>>;

        #[cfg(all(
            feature = "UIDragSession",
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:dropSessionDidEnter:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_dropSessionDidEnter(
            &self,
            text_droppable_view: &UIView,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(all(
            feature = "UIDragSession",
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:dropSessionDidUpdate:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_dropSessionDidUpdate(
            &self,
            text_droppable_view: &UIView,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(all(
            feature = "UIDragSession",
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:dropSessionDidExit:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_dropSessionDidExit(
            &self,
            text_droppable_view: &UIView,
            session: &ProtocolObject<dyn UIDropSession>,
        );

        #[cfg(all(
            feature = "UIDragSession",
            feature = "UIPasteConfigurationSupporting",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UITextPasteConfigurationSupporting",
            feature = "UIView"
        ))]
        /// # Safety
        ///
        /// `text_droppable_view` must implement UITextDroppable.
        #[optional]
        #[unsafe(method(textDroppableView:dropSessionDidEnd:))]
        #[unsafe(method_family = none)]
        unsafe fn textDroppableView_dropSessionDidEnd(
            &self,
            text_droppable_view: &UIView,
            session: &ProtocolObject<dyn UIDropSession>,
        );
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdroprequest?language=objc)
    pub unsafe trait UITextDropRequest: NSObjectProtocol + MainThreadOnly {
        #[cfg(feature = "UITextInput")]
        #[unsafe(method(dropPosition))]
        #[unsafe(method_family = none)]
        fn dropPosition(&self) -> Retained<UITextPosition>;

        #[cfg(all(feature = "UIDropInteraction", feature = "UITextDropProposal"))]
        #[unsafe(method(suggestedProposal))]
        #[unsafe(method_family = none)]
        fn suggestedProposal(&self) -> Retained<UITextDropProposal>;

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

        #[cfg(feature = "UIDragSession")]
        #[unsafe(method(dropSession))]
        #[unsafe(method_family = none)]
        fn dropSession(&self) -> Retained<ProtocolObject<dyn UIDropSession>>;
    }
);
