//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;

use crate::*;

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

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

impl UIPreviewInteraction {
    extern_methods!(
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(initWithView:))]
        #[unsafe(method_family = init)]
        pub fn initWithView(this: Allocated<Self>, view: &UIView) -> Retained<Self>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(view))]
        #[unsafe(method_family = none)]
        pub fn view(&self) -> Option<Retained<UIView>>;

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

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

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

        #[cfg(all(feature = "UIView", feature = "objc2-core-foundation"))]
        #[unsafe(method(locationInCoordinateSpace:))]
        #[unsafe(method_family = none)]
        pub fn locationInCoordinateSpace(
            &self,
            coordinate_space: Option<&ProtocolObject<dyn UICoordinateSpace>>,
        ) -> CGPoint;

        #[unsafe(method(cancelInteraction))]
        #[unsafe(method_family = none)]
        pub fn cancelInteraction(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIPreviewInteraction {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipreviewinteractiondelegate?language=objc)
    pub unsafe trait UIPreviewInteractionDelegate:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(previewInteraction:didUpdatePreviewTransition:ended:))]
        #[unsafe(method_family = none)]
        fn previewInteraction_didUpdatePreviewTransition_ended(
            &self,
            preview_interaction: &UIPreviewInteraction,
            transition_progress: CGFloat,
            ended: bool,
        );

        #[unsafe(method(previewInteractionDidCancel:))]
        #[unsafe(method_family = none)]
        fn previewInteractionDidCancel(&self, preview_interaction: &UIPreviewInteraction);

        #[optional]
        #[unsafe(method(previewInteractionShouldBegin:))]
        #[unsafe(method_family = none)]
        fn previewInteractionShouldBegin(&self, preview_interaction: &UIPreviewInteraction)
            -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        #[optional]
        #[unsafe(method(previewInteraction:didUpdateCommitTransition:ended:))]
        #[unsafe(method_family = none)]
        fn previewInteraction_didUpdateCommitTransition_ended(
            &self,
            preview_interaction: &UIPreviewInteraction,
            transition_progress: CGFloat,
            ended: bool,
        );
    }
);
