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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdirectionalrectedge?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDirectionalRectEdge(pub NSUInteger);
bitflags::bitflags! {
    impl NSDirectionalRectEdge: NSUInteger {
        #[doc(alias = "NSDirectionalRectEdgeNone")]
        const None = 0;
        #[doc(alias = "NSDirectionalRectEdgeTop")]
        const Top = 1<<0;
        #[doc(alias = "NSDirectionalRectEdgeLeading")]
        const Leading = 1<<1;
        #[doc(alias = "NSDirectionalRectEdgeBottom")]
        const Bottom = 1<<2;
        #[doc(alias = "NSDirectionalRectEdgeTrailing")]
        const Trailing = 1<<3;
        #[doc(alias = "NSDirectionalRectEdgeAll")]
        const All = NSDirectionalRectEdge::Top.0|NSDirectionalRectEdge::Leading.0|NSDirectionalRectEdge::Bottom.0|NSDirectionalRectEdge::Trailing.0;
    }
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdirectionaledgeinsets?language=objc)
#[cfg(feature = "objc2-core-foundation")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSDirectionalEdgeInsets {
    pub top: CGFloat,
    pub leading: CGFloat,
    pub bottom: CGFloat,
    pub trailing: CGFloat,
}

#[cfg(feature = "objc2-core-foundation")]
unsafe impl Encode for NSDirectionalEdgeInsets {
    const ENCODING: Encoding = Encoding::Struct(
        "NSDirectionalEdgeInsets",
        &[
            <CGFloat>::ENCODING,
            <CGFloat>::ENCODING,
            <CGFloat>::ENCODING,
            <CGFloat>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2-core-foundation")]
unsafe impl RefEncode for NSDirectionalEdgeInsets {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

#[cfg(feature = "objc2-core-foundation")]
unsafe impl Send for NSDirectionalEdgeInsets {}

#[cfg(feature = "objc2-core-foundation")]
unsafe impl Sync for NSDirectionalEdgeInsets {}

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrectalignment?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRectAlignment(pub NSInteger);
impl NSRectAlignment {
    #[doc(alias = "NSRectAlignmentNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSRectAlignmentTop")]
    pub const Top: Self = Self(1);
    #[doc(alias = "NSRectAlignmentTopLeading")]
    pub const TopLeading: Self = Self(2);
    #[doc(alias = "NSRectAlignmentLeading")]
    pub const Leading: Self = Self(3);
    #[doc(alias = "NSRectAlignmentBottomLeading")]
    pub const BottomLeading: Self = Self(4);
    #[doc(alias = "NSRectAlignmentBottom")]
    pub const Bottom: Self = Self(5);
    #[doc(alias = "NSRectAlignmentBottomTrailing")]
    pub const BottomTrailing: Self = Self(6);
    #[doc(alias = "NSRectAlignmentTrailing")]
    pub const Trailing: Self = Self(7);
    #[doc(alias = "NSRectAlignmentTopTrailing")]
    pub const TopTrailing: Self = Self(8);
}

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

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

#[cfg(feature = "objc2-core-foundation")]
impl NSDirectionalEdgeInsets {
    // TODO: pub fn NSDirectionalEdgeInsetsMake(top: CGFloat,leading: CGFloat,bottom: CGFloat,trailing: CGFloat,) -> NSDirectionalEdgeInsets;
}

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

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

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

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

impl NSCollectionViewCompositionalLayoutConfiguration {
    extern_methods!(
        #[cfg(feature = "NSCollectionViewFlowLayout")]
        #[unsafe(method(scrollDirection))]
        #[unsafe(method_family = none)]
        pub fn scrollDirection(&self) -> NSCollectionViewScrollDirection;

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

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

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

        #[unsafe(method(boundarySupplementaryItems))]
        #[unsafe(method_family = none)]
        pub fn boundarySupplementaryItems(
            &self,
        ) -> Retained<NSArray<NSCollectionLayoutBoundarySupplementaryItem>>;

        /// Setter for [`boundarySupplementaryItems`][Self::boundarySupplementaryItems].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBoundarySupplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn setBoundarySupplementaryItems(
            &self,
            boundary_supplementary_items: &NSArray<NSCollectionLayoutBoundarySupplementaryItem>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSCollectionViewCompositionalLayoutConfiguration {
    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/appkit/nscollectionviewcompositionallayoutsectionprovider?language=objc)
#[cfg(feature = "block2")]
pub type NSCollectionViewCompositionalLayoutSectionProvider = *mut block2::DynBlock<
    dyn Fn(
        NSInteger,
        NonNull<ProtocolObject<dyn NSCollectionLayoutEnvironment>>,
    ) -> *mut NSCollectionLayoutSection,
>;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionviewcompositionallayout?language=objc)
    #[unsafe(super(NSCollectionViewLayout, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSCollectionViewLayout")]
    pub struct NSCollectionViewCompositionalLayout;
);

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

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

#[cfg(feature = "NSCollectionViewLayout")]
impl NSCollectionViewCompositionalLayout {
    extern_methods!(
        #[unsafe(method(initWithSection:))]
        #[unsafe(method_family = init)]
        pub fn initWithSection(
            this: Allocated<Self>,
            section: &NSCollectionLayoutSection,
        ) -> Retained<Self>;

        #[unsafe(method(initWithSection:configuration:))]
        #[unsafe(method_family = init)]
        pub fn initWithSection_configuration(
            this: Allocated<Self>,
            section: &NSCollectionLayoutSection,
            configuration: &NSCollectionViewCompositionalLayoutConfiguration,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `section_provider` must be a valid pointer.
        #[unsafe(method(initWithSectionProvider:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSectionProvider(
            this: Allocated<Self>,
            section_provider: NSCollectionViewCompositionalLayoutSectionProvider,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `section_provider` must be a valid pointer.
        #[unsafe(method(initWithSectionProvider:configuration:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSectionProvider_configuration(
            this: Allocated<Self>,
            section_provider: NSCollectionViewCompositionalLayoutSectionProvider,
            configuration: &NSCollectionViewCompositionalLayoutConfiguration,
        ) -> 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(configuration))]
        #[unsafe(method_family = none)]
        pub fn configuration(&self) -> Retained<NSCollectionViewCompositionalLayoutConfiguration>;

        /// Setter for [`configuration`][Self::configuration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setConfiguration:))]
        #[unsafe(method_family = none)]
        pub fn setConfiguration(
            &self,
            configuration: &NSCollectionViewCompositionalLayoutConfiguration,
        );
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutsectionorthogonalscrollingbehavior?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionLayoutSectionOrthogonalScrollingBehavior(pub NSInteger);
impl NSCollectionLayoutSectionOrthogonalScrollingBehavior {
    #[doc(alias = "NSCollectionLayoutSectionOrthogonalScrollingBehaviorNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSCollectionLayoutSectionOrthogonalScrollingBehaviorContinuous")]
    pub const Continuous: Self = Self(1);
    #[doc(
        alias = "NSCollectionLayoutSectionOrthogonalScrollingBehaviorContinuousGroupLeadingBoundary"
    )]
    pub const ContinuousGroupLeadingBoundary: Self = Self(2);
    #[doc(alias = "NSCollectionLayoutSectionOrthogonalScrollingBehaviorPaging")]
    pub const Paging: Self = Self(3);
    #[doc(alias = "NSCollectionLayoutSectionOrthogonalScrollingBehaviorGroupPaging")]
    pub const GroupPaging: Self = Self(4);
    #[doc(alias = "NSCollectionLayoutSectionOrthogonalScrollingBehaviorGroupPagingCentered")]
    pub const GroupPagingCentered: Self = Self(5);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutsectionvisibleitemsinvalidationhandler?language=objc)
#[cfg(feature = "block2")]
pub type NSCollectionLayoutSectionVisibleItemsInvalidationHandler = *mut block2::DynBlock<
    dyn Fn(
        NonNull<NSArray<ProtocolObject<dyn NSCollectionLayoutVisibleItem>>>,
        NSPoint,
        NonNull<ProtocolObject<dyn NSCollectionLayoutEnvironment>>,
    ),
>;

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

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

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

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

impl NSCollectionLayoutSection {
    extern_methods!(
        #[unsafe(method(sectionWithGroup:))]
        #[unsafe(method_family = none)]
        pub fn sectionWithGroup(group: &NSCollectionLayoutGroup) -> 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>;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`contentInsets`][Self::contentInsets].
        #[unsafe(method(setContentInsets:))]
        #[unsafe(method_family = none)]
        pub fn setContentInsets(&self, content_insets: NSDirectionalEdgeInsets);

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

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

        #[unsafe(method(orthogonalScrollingBehavior))]
        #[unsafe(method_family = none)]
        pub fn orthogonalScrollingBehavior(
            &self,
        ) -> NSCollectionLayoutSectionOrthogonalScrollingBehavior;

        /// Setter for [`orthogonalScrollingBehavior`][Self::orthogonalScrollingBehavior].
        #[unsafe(method(setOrthogonalScrollingBehavior:))]
        #[unsafe(method_family = none)]
        pub fn setOrthogonalScrollingBehavior(
            &self,
            orthogonal_scrolling_behavior: NSCollectionLayoutSectionOrthogonalScrollingBehavior,
        );

        #[unsafe(method(boundarySupplementaryItems))]
        #[unsafe(method_family = none)]
        pub fn boundarySupplementaryItems(
            &self,
        ) -> Retained<NSArray<NSCollectionLayoutBoundarySupplementaryItem>>;

        /// Setter for [`boundarySupplementaryItems`][Self::boundarySupplementaryItems].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBoundarySupplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn setBoundarySupplementaryItems(
            &self,
            boundary_supplementary_items: &NSArray<NSCollectionLayoutBoundarySupplementaryItem>,
        );

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

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

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer.
        /// - The returned block's argument 3 must be a valid pointer.
        #[unsafe(method(visibleItemsInvalidationHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn visibleItemsInvalidationHandler(
            &self,
        ) -> NSCollectionLayoutSectionVisibleItemsInvalidationHandler;

        #[cfg(feature = "block2")]
        /// Setter for [`visibleItemsInvalidationHandler`][Self::visibleItemsInvalidationHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `visible_items_invalidation_handler` must be a valid pointer or null.
        #[unsafe(method(setVisibleItemsInvalidationHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVisibleItemsInvalidationHandler(
            &self,
            visible_items_invalidation_handler: NSCollectionLayoutSectionVisibleItemsInvalidationHandler,
        );

        #[unsafe(method(decorationItems))]
        #[unsafe(method_family = none)]
        pub fn decorationItems(&self) -> Retained<NSArray<NSCollectionLayoutDecorationItem>>;

        /// Setter for [`decorationItems`][Self::decorationItems].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setDecorationItems:))]
        #[unsafe(method_family = none)]
        pub fn setDecorationItems(
            &self,
            decoration_items: &NSArray<NSCollectionLayoutDecorationItem>,
        );
    );
}

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

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

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

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

impl NSCollectionLayoutItem {
    extern_methods!(
        #[unsafe(method(itemWithLayoutSize:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;

        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize_supplementaryItems(
            layout_size: &NSCollectionLayoutSize,
            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
        ) -> 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>;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`contentInsets`][Self::contentInsets].
        #[unsafe(method(setContentInsets:))]
        #[unsafe(method_family = none)]
        pub fn setContentInsets(&self, content_insets: NSDirectionalEdgeInsets);

        #[unsafe(method(edgeSpacing))]
        #[unsafe(method_family = none)]
        pub fn edgeSpacing(&self) -> Option<Retained<NSCollectionLayoutEdgeSpacing>>;

        /// Setter for [`edgeSpacing`][Self::edgeSpacing].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setEdgeSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setEdgeSpacing(&self, edge_spacing: Option<&NSCollectionLayoutEdgeSpacing>);

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

        #[unsafe(method(supplementaryItems))]
        #[unsafe(method_family = none)]
        pub fn supplementaryItems(&self) -> Retained<NSArray<NSCollectionLayoutSupplementaryItem>>;
    );
}

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

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

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

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

impl NSCollectionLayoutGroupCustomItem {
    extern_methods!(
        #[unsafe(method(customItemWithFrame:))]
        #[unsafe(method_family = none)]
        pub fn customItemWithFrame(frame: NSRect, mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(customItemWithFrame:zIndex:))]
        #[unsafe(method_family = none)]
        pub fn customItemWithFrame_zIndex(
            frame: NSRect,
            z_index: NSInteger,
            mtm: MainThreadMarker,
        ) -> 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(frame))]
        #[unsafe(method_family = none)]
        pub fn frame(&self) -> NSRect;

        #[unsafe(method(zIndex))]
        #[unsafe(method_family = none)]
        pub fn zIndex(&self) -> NSInteger;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutgroupcustomitemprovider?language=objc)
#[cfg(feature = "block2")]
pub type NSCollectionLayoutGroupCustomItemProvider = *mut block2::DynBlock<
    dyn Fn(
        NonNull<ProtocolObject<dyn NSCollectionLayoutEnvironment>>,
    ) -> NonNull<NSArray<NSCollectionLayoutGroupCustomItem>>,
>;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutgroup?language=objc)
    #[unsafe(super(NSCollectionLayoutItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSCollectionLayoutGroup;
);

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

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

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

impl NSCollectionLayoutGroup {
    extern_methods!(
        #[unsafe(method(horizontalGroupWithLayoutSize:subitem:count:))]
        #[unsafe(method_family = none)]
        pub fn horizontalGroupWithLayoutSize_subitem_count(
            layout_size: &NSCollectionLayoutSize,
            subitem: &NSCollectionLayoutItem,
            count: NSInteger,
        ) -> Retained<Self>;

        #[unsafe(method(horizontalGroupWithLayoutSize:subitems:))]
        #[unsafe(method_family = none)]
        pub fn horizontalGroupWithLayoutSize_subitems(
            layout_size: &NSCollectionLayoutSize,
            subitems: &NSArray<NSCollectionLayoutItem>,
        ) -> Retained<Self>;

        #[unsafe(method(verticalGroupWithLayoutSize:subitem:count:))]
        #[unsafe(method_family = none)]
        pub fn verticalGroupWithLayoutSize_subitem_count(
            layout_size: &NSCollectionLayoutSize,
            subitem: &NSCollectionLayoutItem,
            count: NSInteger,
        ) -> Retained<Self>;

        #[unsafe(method(verticalGroupWithLayoutSize:subitems:))]
        #[unsafe(method_family = none)]
        pub fn verticalGroupWithLayoutSize_subitems(
            layout_size: &NSCollectionLayoutSize,
            subitems: &NSArray<NSCollectionLayoutItem>,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `item_provider` must be a valid pointer.
        #[unsafe(method(customGroupWithLayoutSize:itemProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn customGroupWithLayoutSize_itemProvider(
            layout_size: &NSCollectionLayoutSize,
            item_provider: NSCollectionLayoutGroupCustomItemProvider,
        ) -> 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(supplementaryItems))]
        #[unsafe(method_family = none)]
        pub fn supplementaryItems(&self) -> Retained<NSArray<NSCollectionLayoutSupplementaryItem>>;

        /// Setter for [`supplementaryItems`][Self::supplementaryItems].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSupplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn setSupplementaryItems(
            &self,
            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
        );

        #[unsafe(method(interItemSpacing))]
        #[unsafe(method_family = none)]
        pub fn interItemSpacing(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;

        /// Setter for [`interItemSpacing`][Self::interItemSpacing].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setInterItemSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setInterItemSpacing(&self, inter_item_spacing: Option<&NSCollectionLayoutSpacing>);

        #[unsafe(method(subitems))]
        #[unsafe(method_family = none)]
        pub fn subitems(&self) -> Retained<NSArray<NSCollectionLayoutItem>>;

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

/// Methods declared on superclass `NSCollectionLayoutItem`.
impl NSCollectionLayoutGroup {
    extern_methods!(
        #[unsafe(method(itemWithLayoutSize:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;

        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize_supplementaryItems(
            layout_size: &NSCollectionLayoutSize,
            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
        ) -> Retained<Self>;
    );
}

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

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

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

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

impl NSCollectionLayoutDimension {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fractionalWidthDimension:))]
        #[unsafe(method_family = none)]
        pub fn fractionalWidthDimension(
            fractional_width: CGFloat,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fractionalHeightDimension:))]
        #[unsafe(method_family = none)]
        pub fn fractionalHeightDimension(
            fractional_height: CGFloat,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(absoluteDimension:))]
        #[unsafe(method_family = none)]
        pub fn absoluteDimension(
            absolute_dimension: CGFloat,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(estimatedDimension:))]
        #[unsafe(method_family = none)]
        pub fn estimatedDimension(
            estimated_dimension: CGFloat,
            mtm: MainThreadMarker,
        ) -> 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(isFractionalWidth))]
        #[unsafe(method_family = none)]
        pub fn isFractionalWidth(&self) -> bool;

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

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

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

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

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

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

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

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

impl NSCollectionLayoutSize {
    extern_methods!(
        #[unsafe(method(sizeWithWidthDimension:heightDimension:))]
        #[unsafe(method_family = none)]
        pub fn sizeWithWidthDimension_heightDimension(
            width: &NSCollectionLayoutDimension,
            height: &NSCollectionLayoutDimension,
        ) -> 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(widthDimension))]
        #[unsafe(method_family = none)]
        pub fn widthDimension(&self) -> Retained<NSCollectionLayoutDimension>;

        #[unsafe(method(heightDimension))]
        #[unsafe(method_family = none)]
        pub fn heightDimension(&self) -> Retained<NSCollectionLayoutDimension>;
    );
}

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

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

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

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

impl NSCollectionLayoutSpacing {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(flexibleSpacing:))]
        #[unsafe(method_family = none)]
        pub fn flexibleSpacing(flexible_spacing: CGFloat, mtm: MainThreadMarker) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fixedSpacing:))]
        #[unsafe(method_family = none)]
        pub fn fixedSpacing(fixed_spacing: CGFloat, mtm: MainThreadMarker) -> 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>;

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

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

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

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

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

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

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

impl NSCollectionLayoutEdgeSpacing {
    extern_methods!(
        #[unsafe(method(spacingForLeading:top:trailing:bottom:))]
        #[unsafe(method_family = none)]
        pub fn spacingForLeading_top_trailing_bottom(
            leading: Option<&NSCollectionLayoutSpacing>,
            top: Option<&NSCollectionLayoutSpacing>,
            trailing: Option<&NSCollectionLayoutSpacing>,
            bottom: Option<&NSCollectionLayoutSpacing>,
            mtm: MainThreadMarker,
        ) -> 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(leading))]
        #[unsafe(method_family = none)]
        pub fn leading(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;

        #[unsafe(method(top))]
        #[unsafe(method_family = none)]
        pub fn top(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;

        #[unsafe(method(trailing))]
        #[unsafe(method_family = none)]
        pub fn trailing(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;

        #[unsafe(method(bottom))]
        #[unsafe(method_family = none)]
        pub fn bottom(&self) -> Option<Retained<NSCollectionLayoutSpacing>>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutsupplementaryitem?language=objc)
    #[unsafe(super(NSCollectionLayoutItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSCollectionLayoutSupplementaryItem;
);

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

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

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

impl NSCollectionLayoutSupplementaryItem {
    extern_methods!(
        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:))]
        #[unsafe(method_family = none)]
        pub fn supplementaryItemWithLayoutSize_elementKind_containerAnchor(
            layout_size: &NSCollectionLayoutSize,
            element_kind: &NSString,
            container_anchor: &NSCollectionLayoutAnchor,
        ) -> Retained<Self>;

        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:itemAnchor:))]
        #[unsafe(method_family = none)]
        pub fn supplementaryItemWithLayoutSize_elementKind_containerAnchor_itemAnchor(
            layout_size: &NSCollectionLayoutSize,
            element_kind: &NSString,
            container_anchor: &NSCollectionLayoutAnchor,
            item_anchor: &NSCollectionLayoutAnchor,
        ) -> 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(zIndex))]
        #[unsafe(method_family = none)]
        pub fn zIndex(&self) -> NSInteger;

        /// Setter for [`zIndex`][Self::zIndex].
        #[unsafe(method(setZIndex:))]
        #[unsafe(method_family = none)]
        pub fn setZIndex(&self, z_index: NSInteger);

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

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

        #[unsafe(method(itemAnchor))]
        #[unsafe(method_family = none)]
        pub fn itemAnchor(&self) -> Option<Retained<NSCollectionLayoutAnchor>>;
    );
}

/// Methods declared on superclass `NSCollectionLayoutItem`.
impl NSCollectionLayoutSupplementaryItem {
    extern_methods!(
        #[unsafe(method(itemWithLayoutSize:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;

        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize_supplementaryItems(
            layout_size: &NSCollectionLayoutSize,
            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
        ) -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutboundarysupplementaryitem?language=objc)
    #[unsafe(super(NSCollectionLayoutSupplementaryItem, NSCollectionLayoutItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSCollectionLayoutBoundarySupplementaryItem;
);

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

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

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

impl NSCollectionLayoutBoundarySupplementaryItem {
    extern_methods!(
        #[unsafe(method(boundarySupplementaryItemWithLayoutSize:elementKind:alignment:))]
        #[unsafe(method_family = none)]
        pub fn boundarySupplementaryItemWithLayoutSize_elementKind_alignment(
            layout_size: &NSCollectionLayoutSize,
            element_kind: &NSString,
            alignment: NSRectAlignment,
        ) -> Retained<Self>;

        #[unsafe(method(boundarySupplementaryItemWithLayoutSize:elementKind:alignment:absoluteOffset:))]
        #[unsafe(method_family = none)]
        pub fn boundarySupplementaryItemWithLayoutSize_elementKind_alignment_absoluteOffset(
            layout_size: &NSCollectionLayoutSize,
            element_kind: &NSString,
            alignment: NSRectAlignment,
            absolute_offset: NSPoint,
        ) -> 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(extendsBoundary))]
        #[unsafe(method_family = none)]
        pub fn extendsBoundary(&self) -> bool;

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

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

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

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

        #[unsafe(method(offset))]
        #[unsafe(method_family = none)]
        pub fn offset(&self) -> NSPoint;
    );
}

/// Methods declared on superclass `NSCollectionLayoutSupplementaryItem`.
impl NSCollectionLayoutBoundarySupplementaryItem {
    extern_methods!(
        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:))]
        #[unsafe(method_family = none)]
        pub fn supplementaryItemWithLayoutSize_elementKind_containerAnchor(
            layout_size: &NSCollectionLayoutSize,
            element_kind: &NSString,
            container_anchor: &NSCollectionLayoutAnchor,
        ) -> Retained<Self>;

        #[unsafe(method(supplementaryItemWithLayoutSize:elementKind:containerAnchor:itemAnchor:))]
        #[unsafe(method_family = none)]
        pub fn supplementaryItemWithLayoutSize_elementKind_containerAnchor_itemAnchor(
            layout_size: &NSCollectionLayoutSize,
            element_kind: &NSString,
            container_anchor: &NSCollectionLayoutAnchor,
            item_anchor: &NSCollectionLayoutAnchor,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSCollectionLayoutItem`.
impl NSCollectionLayoutBoundarySupplementaryItem {
    extern_methods!(
        #[unsafe(method(itemWithLayoutSize:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;

        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize_supplementaryItems(
            layout_size: &NSCollectionLayoutSize,
            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
        ) -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutdecorationitem?language=objc)
    #[unsafe(super(NSCollectionLayoutItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSCollectionLayoutDecorationItem;
);

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

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

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

impl NSCollectionLayoutDecorationItem {
    extern_methods!(
        #[unsafe(method(backgroundDecorationItemWithElementKind:))]
        #[unsafe(method_family = none)]
        pub fn backgroundDecorationItemWithElementKind(
            element_kind: &NSString,
            mtm: MainThreadMarker,
        ) -> 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(zIndex))]
        #[unsafe(method_family = none)]
        pub fn zIndex(&self) -> NSInteger;

        /// Setter for [`zIndex`][Self::zIndex].
        #[unsafe(method(setZIndex:))]
        #[unsafe(method_family = none)]
        pub fn setZIndex(&self, z_index: NSInteger);

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

/// Methods declared on superclass `NSCollectionLayoutItem`.
impl NSCollectionLayoutDecorationItem {
    extern_methods!(
        #[unsafe(method(itemWithLayoutSize:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize(layout_size: &NSCollectionLayoutSize) -> Retained<Self>;

        #[unsafe(method(itemWithLayoutSize:supplementaryItems:))]
        #[unsafe(method_family = none)]
        pub fn itemWithLayoutSize_supplementaryItems(
            layout_size: &NSCollectionLayoutSize,
            supplementary_items: &NSArray<NSCollectionLayoutSupplementaryItem>,
        ) -> Retained<Self>;
    );
}

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

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

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

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

impl NSCollectionLayoutAnchor {
    extern_methods!(
        #[unsafe(method(layoutAnchorWithEdges:))]
        #[unsafe(method_family = none)]
        pub fn layoutAnchorWithEdges(
            edges: NSDirectionalRectEdge,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[unsafe(method(layoutAnchorWithEdges:absoluteOffset:))]
        #[unsafe(method_family = none)]
        pub fn layoutAnchorWithEdges_absoluteOffset(
            edges: NSDirectionalRectEdge,
            absolute_offset: NSPoint,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[unsafe(method(layoutAnchorWithEdges:fractionalOffset:))]
        #[unsafe(method_family = none)]
        pub fn layoutAnchorWithEdges_fractionalOffset(
            edges: NSDirectionalRectEdge,
            fractional_offset: NSPoint,
            mtm: MainThreadMarker,
        ) -> 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(edges))]
        #[unsafe(method_family = none)]
        pub fn edges(&self) -> NSDirectionalRectEdge;

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

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutcontainer?language=objc)
    pub unsafe trait NSCollectionLayoutContainer: NSObjectProtocol + MainThreadOnly {
        #[unsafe(method(contentSize))]
        #[unsafe(method_family = none)]
        fn contentSize(&self) -> NSSize;

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(effectiveContentInsets))]
        #[unsafe(method_family = none)]
        fn effectiveContentInsets(&self) -> NSDirectionalEdgeInsets;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutenvironment?language=objc)
    pub unsafe trait NSCollectionLayoutEnvironment:
        NSObjectProtocol + MainThreadOnly
    {
        #[unsafe(method(container))]
        #[unsafe(method_family = none)]
        fn container(&self) -> Retained<ProtocolObject<dyn NSCollectionLayoutContainer>>;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionlayoutvisibleitem?language=objc)
    pub unsafe trait NSCollectionLayoutVisibleItem:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(alpha))]
        #[unsafe(method_family = none)]
        fn alpha(&self) -> CGFloat;

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

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

        /// Setter for [`zIndex`][Self::zIndex].
        #[unsafe(method(setZIndex:))]
        #[unsafe(method_family = none)]
        fn setZIndex(&self, z_index: NSInteger);

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

        /// Setter for [`isHidden`][Self::isHidden].
        #[unsafe(method(setHidden:))]
        #[unsafe(method_family = none)]
        fn setHidden(&self, hidden: bool);

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

        /// Setter for [`center`][Self::center].
        #[unsafe(method(setCenter:))]
        #[unsafe(method_family = none)]
        fn setCenter(&self, center: NSPoint);

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

        #[unsafe(method(indexPath))]
        #[unsafe(method_family = none)]
        fn indexPath(&self) -> Retained<NSIndexPath>;

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

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

        #[cfg(feature = "NSCollectionViewLayout")]
        #[unsafe(method(representedElementCategory))]
        #[unsafe(method_family = none)]
        fn representedElementCategory(&self) -> NSCollectionElementCategory;

        #[unsafe(method(representedElementKind))]
        #[unsafe(method_family = none)]
        fn representedElementKind(&self) -> Option<Retained<NSString>>;
    }
);
