//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationItemLargeTitleDisplayMode(pub NSInteger);
impl UINavigationItemLargeTitleDisplayMode {
    #[doc(alias = "UINavigationItemLargeTitleDisplayModeAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "UINavigationItemLargeTitleDisplayModeAlways")]
    pub const Always: Self = Self(1);
    #[doc(alias = "UINavigationItemLargeTitleDisplayModeNever")]
    pub const Never: Self = Self(2);
    #[doc(alias = "UINavigationItemLargeTitleDisplayModeInline")]
    pub const Inline: Self = Self(3);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationItemBackButtonDisplayMode(pub NSInteger);
impl UINavigationItemBackButtonDisplayMode {
    #[doc(alias = "UINavigationItemBackButtonDisplayModeDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "UINavigationItemBackButtonDisplayModeGeneric")]
    pub const Generic: Self = Self(1);
    #[doc(alias = "UINavigationItemBackButtonDisplayModeMinimal")]
    pub const Minimal: Self = Self(2);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationItemSearchBarPlacement(pub NSInteger);
impl UINavigationItemSearchBarPlacement {
    #[doc(alias = "UINavigationItemSearchBarPlacementAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "UINavigationItemSearchBarPlacementInline")]
    pub const Inline: Self = Self(1);
    #[doc(alias = "UINavigationItemSearchBarPlacementStacked")]
    pub const Stacked: Self = Self(2);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINavigationItemStyle(pub NSInteger);
impl UINavigationItemStyle {
    #[doc(alias = "UINavigationItemStyleNavigator")]
    pub const Navigator: Self = Self(0);
    #[doc(alias = "UINavigationItemStyleBrowser")]
    pub const Browser: Self = Self(1);
    #[doc(alias = "UINavigationItemStyleEditor")]
    pub const Editor: Self = Self(2);
}

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

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

extern_protocol!(
    pub unsafe trait UINavigationItemRenameDelegate:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[method(navigationItem:didEndRenamingWithTitle:)]
        unsafe fn navigationItem_didEndRenamingWithTitle(
            &self,
            navigation_item: &UINavigationItem,
            title: &NSString,
        );

        #[optional]
        #[method(navigationItemShouldBeginRenaming:)]
        unsafe fn navigationItemShouldBeginRenaming(
            &self,
            navigation_item: &UINavigationItem,
        ) -> bool;

        #[optional]
        #[method_id(@__retain_semantics Other navigationItem:willBeginRenamingWithSuggestedTitle:selectedRange:)]
        unsafe fn navigationItem_willBeginRenamingWithSuggestedTitle_selectedRange(
            &self,
            navigation_item: &UINavigationItem,
            title: &NSString,
            selected_range: NonNull<NSRange>,
        ) -> Retained<NSString>;

        #[optional]
        #[method(navigationItem:shouldEndRenamingWithTitle:)]
        unsafe fn navigationItem_shouldEndRenamingWithTitle(
            &self,
            navigation_item: &UINavigationItem,
            title: &NSString,
        ) -> bool;
    }

    unsafe impl ProtocolType for dyn UINavigationItemRenameDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UINavigationItem;

    unsafe impl ClassType for UINavigationItem {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSCoding for UINavigationItem {}

unsafe impl NSObjectProtocol for UINavigationItem {}

extern_methods!(
    unsafe impl UINavigationItem {
        #[method_id(@__retain_semantics Init initWithTitle:)]
        pub unsafe fn initWithTitle(this: Allocated<Self>, title: &NSString) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Option<Retained<NSString>>;

        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: Option<&NSString>);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method_id(@__retain_semantics Other titleView)]
        pub unsafe fn titleView(&self) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(setTitleView:)]
        pub unsafe fn setTitleView(&self, title_view: Option<&UIView>);

        #[method_id(@__retain_semantics Other prompt)]
        pub unsafe fn prompt(&self) -> Option<Retained<NSString>>;

        #[method(setPrompt:)]
        pub unsafe fn setPrompt(&self, prompt: Option<&NSString>);

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other backBarButtonItem)]
        pub unsafe fn backBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setBackBarButtonItem:)]
        pub unsafe fn setBackBarButtonItem(&self, back_bar_button_item: Option<&UIBarButtonItem>);

        #[method_id(@__retain_semantics Other backButtonTitle)]
        pub unsafe fn backButtonTitle(&self) -> Option<Retained<NSString>>;

        #[method(setBackButtonTitle:)]
        pub unsafe fn setBackButtonTitle(&self, back_button_title: Option<&NSString>);

        #[method(hidesBackButton)]
        pub unsafe fn hidesBackButton(&self) -> bool;

        #[method(setHidesBackButton:)]
        pub unsafe fn setHidesBackButton(&self, hides_back_button: bool);

        #[method(setHidesBackButton:animated:)]
        pub unsafe fn setHidesBackButton_animated(&self, hides_back_button: bool, animated: bool);

        #[method(backButtonDisplayMode)]
        pub unsafe fn backButtonDisplayMode(&self) -> UINavigationItemBackButtonDisplayMode;

        #[method(setBackButtonDisplayMode:)]
        pub unsafe fn setBackButtonDisplayMode(
            &self,
            back_button_display_mode: UINavigationItemBackButtonDisplayMode,
        );

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method_id(@__retain_semantics Other backAction)]
        pub unsafe fn backAction(&self) -> Option<Retained<UIAction>>;

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method(setBackAction:)]
        pub unsafe fn setBackAction(&self, back_action: Option<&UIAction>);

        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
        #[method(titleMenuProvider)]
        pub unsafe fn titleMenuProvider(
            &self,
        ) -> *mut block2::Block<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>;

        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
        #[method(setTitleMenuProvider:)]
        pub unsafe fn setTitleMenuProvider(
            &self,
            title_menu_provider: Option<
                &block2::Block<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>,
            >,
        );

        #[method_id(@__retain_semantics Other renameDelegate)]
        pub unsafe fn renameDelegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UINavigationItemRenameDelegate>>>;

        #[method(setRenameDelegate:)]
        pub unsafe fn setRenameDelegate(
            &self,
            rename_delegate: Option<&ProtocolObject<dyn UINavigationItemRenameDelegate>>,
        );

        #[cfg(feature = "UIDocumentProperties")]
        #[method_id(@__retain_semantics Other documentProperties)]
        pub unsafe fn documentProperties(&self) -> Option<Retained<UIDocumentProperties>>;

        #[cfg(feature = "UIDocumentProperties")]
        #[method(setDocumentProperties:)]
        pub unsafe fn setDocumentProperties(
            &self,
            document_properties: Option<&UIDocumentProperties>,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other leftBarButtonItems)]
        pub unsafe fn leftBarButtonItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setLeftBarButtonItems:)]
        pub unsafe fn setLeftBarButtonItems(
            &self,
            left_bar_button_items: Option<&NSArray<UIBarButtonItem>>,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other rightBarButtonItems)]
        pub unsafe fn rightBarButtonItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setRightBarButtonItems:)]
        pub unsafe fn setRightBarButtonItems(
            &self,
            right_bar_button_items: Option<&NSArray<UIBarButtonItem>>,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setLeftBarButtonItems:animated:)]
        pub unsafe fn setLeftBarButtonItems_animated(
            &self,
            items: Option<&NSArray<UIBarButtonItem>>,
            animated: bool,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setRightBarButtonItems:animated:)]
        pub unsafe fn setRightBarButtonItems_animated(
            &self,
            items: Option<&NSArray<UIBarButtonItem>>,
            animated: bool,
        );

        #[method(leftItemsSupplementBackButton)]
        pub unsafe fn leftItemsSupplementBackButton(&self) -> bool;

        #[method(setLeftItemsSupplementBackButton:)]
        pub unsafe fn setLeftItemsSupplementBackButton(
            &self,
            left_items_supplement_back_button: bool,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other leftBarButtonItem)]
        pub unsafe fn leftBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setLeftBarButtonItem:)]
        pub unsafe fn setLeftBarButtonItem(&self, left_bar_button_item: Option<&UIBarButtonItem>);

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method_id(@__retain_semantics Other rightBarButtonItem)]
        pub unsafe fn rightBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setRightBarButtonItem:)]
        pub unsafe fn setRightBarButtonItem(&self, right_bar_button_item: Option<&UIBarButtonItem>);

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setLeftBarButtonItem:animated:)]
        pub unsafe fn setLeftBarButtonItem_animated(
            &self,
            item: Option<&UIBarButtonItem>,
            animated: bool,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[method(setRightBarButtonItem:animated:)]
        pub unsafe fn setRightBarButtonItem_animated(
            &self,
            item: Option<&UIBarButtonItem>,
            animated: bool,
        );

        #[method_id(@__retain_semantics Other customizationIdentifier)]
        pub unsafe fn customizationIdentifier(&self) -> Option<Retained<NSString>>;

        #[method(setCustomizationIdentifier:)]
        pub unsafe fn setCustomizationIdentifier(
            &self,
            customization_identifier: Option<&NSString>,
        );

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method_id(@__retain_semantics Other leadingItemGroups)]
        pub unsafe fn leadingItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method(setLeadingItemGroups:)]
        pub unsafe fn setLeadingItemGroups(
            &self,
            leading_item_groups: &NSArray<UIBarButtonItemGroup>,
        );

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method_id(@__retain_semantics Other centerItemGroups)]
        pub unsafe fn centerItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method(setCenterItemGroups:)]
        pub unsafe fn setCenterItemGroups(
            &self,
            center_item_groups: &NSArray<UIBarButtonItemGroup>,
        );

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method_id(@__retain_semantics Other trailingItemGroups)]
        pub unsafe fn trailingItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method(setTrailingItemGroups:)]
        pub unsafe fn setTrailingItemGroups(
            &self,
            trailing_item_groups: &NSArray<UIBarButtonItemGroup>,
        );

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method_id(@__retain_semantics Other pinnedTrailingGroup)]
        pub unsafe fn pinnedTrailingGroup(&self) -> Option<Retained<UIBarButtonItemGroup>>;

        #[cfg(feature = "UIBarButtonItemGroup")]
        #[method(setPinnedTrailingGroup:)]
        pub unsafe fn setPinnedTrailingGroup(
            &self,
            pinned_trailing_group: Option<&UIBarButtonItemGroup>,
        );

        #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
        #[method_id(@__retain_semantics Other additionalOverflowItems)]
        pub unsafe fn additionalOverflowItems(&self) -> Option<Retained<UIDeferredMenuElement>>;

        #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
        #[method(setAdditionalOverflowItems:)]
        pub unsafe fn setAdditionalOverflowItems(
            &self,
            additional_overflow_items: Option<&UIDeferredMenuElement>,
        );

        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
        #[method_id(@__retain_semantics Other overflowPresentationSource)]
        pub unsafe fn overflowPresentationSource(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;

        #[method(largeTitleDisplayMode)]
        pub unsafe fn largeTitleDisplayMode(&self) -> UINavigationItemLargeTitleDisplayMode;

        #[method(setLargeTitleDisplayMode:)]
        pub unsafe fn setLargeTitleDisplayMode(
            &self,
            large_title_display_mode: UINavigationItemLargeTitleDisplayMode,
        );

        #[method(style)]
        pub unsafe fn style(&self) -> UINavigationItemStyle;

        #[method(setStyle:)]
        pub unsafe fn setStyle(&self, style: UINavigationItemStyle);

        #[cfg(all(
            feature = "UIResponder",
            feature = "UISearchController",
            feature = "UIViewController"
        ))]
        #[method_id(@__retain_semantics Other searchController)]
        pub unsafe fn searchController(&self) -> Option<Retained<UISearchController>>;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UISearchController",
            feature = "UIViewController"
        ))]
        #[method(setSearchController:)]
        pub unsafe fn setSearchController(&self, search_controller: Option<&UISearchController>);

        #[method(hidesSearchBarWhenScrolling)]
        pub unsafe fn hidesSearchBarWhenScrolling(&self) -> bool;

        #[method(setHidesSearchBarWhenScrolling:)]
        pub unsafe fn setHidesSearchBarWhenScrolling(&self, hides_search_bar_when_scrolling: bool);

        #[method(preferredSearchBarPlacement)]
        pub unsafe fn preferredSearchBarPlacement(&self) -> UINavigationItemSearchBarPlacement;

        #[method(setPreferredSearchBarPlacement:)]
        pub unsafe fn setPreferredSearchBarPlacement(
            &self,
            preferred_search_bar_placement: UINavigationItemSearchBarPlacement,
        );

        #[method(searchBarPlacement)]
        pub unsafe fn searchBarPlacement(&self) -> UINavigationItemSearchBarPlacement;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other standardAppearance)]
        pub unsafe fn standardAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setStandardAppearance:)]
        pub unsafe fn setStandardAppearance(
            &self,
            standard_appearance: Option<&UINavigationBarAppearance>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other compactAppearance)]
        pub unsafe fn compactAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setCompactAppearance:)]
        pub unsafe fn setCompactAppearance(
            &self,
            compact_appearance: Option<&UINavigationBarAppearance>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other scrollEdgeAppearance)]
        pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setScrollEdgeAppearance:)]
        pub unsafe fn setScrollEdgeAppearance(
            &self,
            scroll_edge_appearance: Option<&UINavigationBarAppearance>,
        );

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method_id(@__retain_semantics Other compactScrollEdgeAppearance)]
        pub unsafe fn compactScrollEdgeAppearance(
            &self,
        ) -> Option<Retained<UINavigationBarAppearance>>;

        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
        #[method(setCompactScrollEdgeAppearance:)]
        pub unsafe fn setCompactScrollEdgeAppearance(
            &self,
            compact_scroll_edge_appearance: Option<&UINavigationBarAppearance>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UINavigationItem {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);
