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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewcellregistrationconfigurationhandler?language=objc)
#[cfg(all(
    feature = "UICollectionViewCell",
    feature = "UIResponder",
    feature = "UIView",
    feature = "block2"
))]
pub type UICollectionViewCellRegistrationConfigurationHandler = *mut block2::DynBlock<
    dyn Fn(NonNull<UICollectionViewCell>, NonNull<NSIndexPath>, NonNull<AnyObject>),
>;

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

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

impl UICollectionViewCellRegistration {
    extern_methods!(
        #[cfg(all(
            feature = "UICollectionViewCell",
            feature = "UIResponder",
            feature = "UIView",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// - `cell_class` probably has further requirements.
        /// - `configuration_handler` must be a valid pointer.
        #[unsafe(method(registrationWithCellClass:configurationHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registrationWithCellClass_configurationHandler(
            cell_class: &AnyClass,
            configuration_handler: UICollectionViewCellRegistrationConfigurationHandler,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "UICollectionViewCell",
            feature = "UINib",
            feature = "UIResponder",
            feature = "UIView",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// `configuration_handler` must be a valid pointer.
        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
        #[unsafe(method(registrationWithCellNib:configurationHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registrationWithCellNib_configurationHandler(
            cell_nib: &UINib,
            configuration_handler: UICollectionViewCellRegistrationConfigurationHandler,
        ) -> Retained<Self>;

        #[unsafe(method(cellClass))]
        #[unsafe(method_family = none)]
        pub fn cellClass(&self) -> Option<&'static AnyClass>;

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

        #[cfg(all(
            feature = "UICollectionViewCell",
            feature = "UIResponder",
            feature = "UIView",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer.
        /// - The returned block's argument 2 must be a valid pointer.
        /// - The returned block's argument 3 must be a valid pointer.
        #[unsafe(method(configurationHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurationHandler(
            &self,
        ) -> UICollectionViewCellRegistrationConfigurationHandler;
    );
}

/// Methods declared on superclass `NSObject`.
impl UICollectionViewCellRegistration {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewsupplementaryregistrationconfigurationhandler?language=objc)
#[cfg(all(
    feature = "UICollectionViewCell",
    feature = "UIResponder",
    feature = "UIView",
    feature = "block2"
))]
pub type UICollectionViewSupplementaryRegistrationConfigurationHandler = *mut block2::DynBlock<
    dyn Fn(NonNull<UICollectionReusableView>, NonNull<NSString>, NonNull<NSIndexPath>),
>;

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

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

impl UICollectionViewSupplementaryRegistration {
    extern_methods!(
        #[cfg(all(
            feature = "UICollectionViewCell",
            feature = "UIResponder",
            feature = "UIView",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// - `supplementary_class` probably has further requirements.
        /// - `configuration_handler` must be a valid pointer.
        #[unsafe(method(registrationWithSupplementaryClass:elementKind:configurationHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registrationWithSupplementaryClass_elementKind_configurationHandler(
            supplementary_class: &AnyClass,
            element_kind: &NSString,
            configuration_handler: UICollectionViewSupplementaryRegistrationConfigurationHandler,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "UICollectionViewCell",
            feature = "UINib",
            feature = "UIResponder",
            feature = "UIView",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// `configuration_handler` must be a valid pointer.
        #[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
        #[unsafe(method(registrationWithSupplementaryNib:elementKind:configurationHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registrationWithSupplementaryNib_elementKind_configurationHandler(
            supplementary_nib: &UINib,
            element_kind: &NSString,
            configuration_handler: UICollectionViewSupplementaryRegistrationConfigurationHandler,
        ) -> Retained<Self>;

        #[unsafe(method(supplementaryClass))]
        #[unsafe(method_family = none)]
        pub fn supplementaryClass(&self) -> Option<&'static AnyClass>;

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

        #[unsafe(method(elementKind))]
        #[unsafe(method_family = none)]
        pub fn elementKind(&self) -> Retained<NSString>;

        #[cfg(all(
            feature = "UICollectionViewCell",
            feature = "UIResponder",
            feature = "UIView",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer.
        /// - The returned block's argument 2 must be a valid pointer.
        /// - The returned block's argument 3 must be a valid pointer.
        #[unsafe(method(configurationHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurationHandler(
            &self,
        ) -> UICollectionViewSupplementaryRegistrationConfigurationHandler;
    );
}

/// Methods declared on superclass `NSObject`.
impl UICollectionViewSupplementaryRegistration {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

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