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

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewflowlayoutautomaticsize?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static UICollectionViewFlowLayoutAutomaticSize: CGSize;
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewflowlayoutsectioninsetreference?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICollectionViewFlowLayoutSectionInsetReference(pub NSInteger);
impl UICollectionViewFlowLayoutSectionInsetReference {
    #[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromContentInset")]
    pub const FromContentInset: Self = Self(0);
    #[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromSafeArea")]
    pub const FromSafeArea: Self = Self(1);
    #[doc(alias = "UICollectionViewFlowLayoutSectionInsetFromLayoutMargins")]
    pub const FromLayoutMargins: Self = Self(2);
}

unsafe impl Encode for UICollectionViewFlowLayoutSectionInsetReference {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

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

#[cfg(feature = "UICollectionViewLayout")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UICollectionViewFlowLayoutInvalidationContext {}
);

#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayoutInvalidationContext {
    extern_methods!(
        #[unsafe(method(invalidateFlowLayoutDelegateMetrics))]
        #[unsafe(method_family = none)]
        pub fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;

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

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

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

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayoutInvalidationContext {
    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>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicollectionviewdelegateflowlayout?language=objc)
    #[cfg(all(feature = "UICollectionView", feature = "UIScrollView"))]
    pub unsafe trait UICollectionViewDelegateFlowLayout:
        UICollectionViewDelegate + MainThreadOnly
    {
        #[cfg(all(
            feature = "UICollectionViewLayout",
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:sizeForItemAtIndexPath:))]
        #[unsafe(method_family = none)]
        fn collectionView_layout_sizeForItemAtIndexPath(
            &self,
            collection_view: &UICollectionView,
            collection_view_layout: &UICollectionViewLayout,
            index_path: &NSIndexPath,
        ) -> CGSize;

        #[cfg(all(
            feature = "UICollectionViewLayout",
            feature = "UIGeometry",
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:insetForSectionAtIndex:))]
        #[unsafe(method_family = none)]
        fn collectionView_layout_insetForSectionAtIndex(
            &self,
            collection_view: &UICollectionView,
            collection_view_layout: &UICollectionViewLayout,
            section: NSInteger,
        ) -> UIEdgeInsets;

        #[cfg(all(
            feature = "UICollectionViewLayout",
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:minimumLineSpacingForSectionAtIndex:))]
        #[unsafe(method_family = none)]
        fn collectionView_layout_minimumLineSpacingForSectionAtIndex(
            &self,
            collection_view: &UICollectionView,
            collection_view_layout: &UICollectionViewLayout,
            section: NSInteger,
        ) -> CGFloat;

        #[cfg(all(
            feature = "UICollectionViewLayout",
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:))]
        #[unsafe(method_family = none)]
        fn collectionView_layout_minimumInteritemSpacingForSectionAtIndex(
            &self,
            collection_view: &UICollectionView,
            collection_view_layout: &UICollectionViewLayout,
            section: NSInteger,
        ) -> CGFloat;

        #[cfg(all(
            feature = "UICollectionViewLayout",
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:referenceSizeForHeaderInSection:))]
        #[unsafe(method_family = none)]
        fn collectionView_layout_referenceSizeForHeaderInSection(
            &self,
            collection_view: &UICollectionView,
            collection_view_layout: &UICollectionViewLayout,
            section: NSInteger,
        ) -> CGSize;

        #[cfg(all(
            feature = "UICollectionViewLayout",
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(collectionView:layout:referenceSizeForFooterInSection:))]
        #[unsafe(method_family = none)]
        fn collectionView_layout_referenceSizeForFooterInSection(
            &self,
            collection_view: &UICollectionView,
            collection_view_layout: &UICollectionViewLayout,
            section: NSInteger,
        ) -> CGSize;
    }
);

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

#[cfg(feature = "UICollectionViewLayout")]
extern_conformance!(
    unsafe impl NSCoding for UICollectionViewFlowLayout {}
);

#[cfg(feature = "UICollectionViewLayout")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UICollectionViewFlowLayout {}
);

#[cfg(feature = "UICollectionViewLayout")]
impl UICollectionViewFlowLayout {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minimumLineSpacing))]
        #[unsafe(method_family = none)]
        pub fn minimumLineSpacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`minimumLineSpacing`][Self::minimumLineSpacing].
        #[unsafe(method(setMinimumLineSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minimumInteritemSpacing))]
        #[unsafe(method_family = none)]
        pub fn minimumInteritemSpacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`minimumInteritemSpacing`][Self::minimumInteritemSpacing].
        #[unsafe(method(setMinimumInteritemSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(itemSize))]
        #[unsafe(method_family = none)]
        pub fn itemSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`itemSize`][Self::itemSize].
        #[unsafe(method(setItemSize:))]
        #[unsafe(method_family = none)]
        pub fn setItemSize(&self, item_size: CGSize);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(estimatedItemSize))]
        #[unsafe(method_family = none)]
        pub fn estimatedItemSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`estimatedItemSize`][Self::estimatedItemSize].
        #[unsafe(method(setEstimatedItemSize:))]
        #[unsafe(method_family = none)]
        pub fn setEstimatedItemSize(&self, estimated_item_size: CGSize);

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

        /// Setter for [`scrollDirection`][Self::scrollDirection].
        #[unsafe(method(setScrollDirection:))]
        #[unsafe(method_family = none)]
        pub fn setScrollDirection(&self, scroll_direction: UICollectionViewScrollDirection);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(headerReferenceSize))]
        #[unsafe(method_family = none)]
        pub fn headerReferenceSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`headerReferenceSize`][Self::headerReferenceSize].
        #[unsafe(method(setHeaderReferenceSize:))]
        #[unsafe(method_family = none)]
        pub fn setHeaderReferenceSize(&self, header_reference_size: CGSize);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(footerReferenceSize))]
        #[unsafe(method_family = none)]
        pub fn footerReferenceSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`footerReferenceSize`][Self::footerReferenceSize].
        #[unsafe(method(setFooterReferenceSize:))]
        #[unsafe(method_family = none)]
        pub fn setFooterReferenceSize(&self, footer_reference_size: CGSize);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(sectionInset))]
        #[unsafe(method_family = none)]
        pub fn sectionInset(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`sectionInset`][Self::sectionInset].
        #[unsafe(method(setSectionInset:))]
        #[unsafe(method_family = none)]
        pub fn setSectionInset(&self, section_inset: UIEdgeInsets);

        /// The reference boundary that the section insets will be defined as relative to. Defaults to `.fromContentInset`.
        /// NOTE: Content inset will always be respected at a minimum. For example, if the sectionInsetReference equals `.fromSafeArea`, but the adjusted content inset is greater that the combination of the safe area and section insets, then section content will be aligned with the content inset instead.
        #[unsafe(method(sectionInsetReference))]
        #[unsafe(method_family = none)]
        pub fn sectionInsetReference(&self) -> UICollectionViewFlowLayoutSectionInsetReference;

        /// Setter for [`sectionInsetReference`][Self::sectionInsetReference].
        #[unsafe(method(setSectionInsetReference:))]
        #[unsafe(method_family = none)]
        pub fn setSectionInsetReference(
            &self,
            section_inset_reference: UICollectionViewFlowLayoutSectionInsetReference,
        );

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

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

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

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

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

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

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