//! 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/appkit/nspagecontrollerobjectidentifier?language=objc)
pub type NSPageControllerObjectIdentifier = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspagecontrollertransitionstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPageControllerTransitionStyle(pub NSInteger);
impl NSPageControllerTransitionStyle {
    #[doc(alias = "NSPageControllerTransitionStyleStackHistory")]
    pub const StackHistory: Self = Self(0);
    #[doc(alias = "NSPageControllerTransitionStyleStackBook")]
    pub const StackBook: Self = Self(1);
    #[doc(alias = "NSPageControllerTransitionStyleHorizontalStrip")]
    pub const HorizontalStrip: Self = Self(2);
}

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

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

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

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSResponder",
    feature = "NSViewController"
))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSPageController {}
);

#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
extern_conformance!(
    unsafe impl NSCoding for NSPageController {}
);

#[cfg(all(
    feature = "NSKeyValueBinding",
    feature = "NSResponder",
    feature = "NSViewController"
))]
extern_conformance!(
    unsafe impl NSEditor for NSPageController {}
);

#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSPageController {}
);

#[cfg(all(
    feature = "NSResponder",
    feature = "NSStoryboardSegue",
    feature = "NSViewController"
))]
extern_conformance!(
    unsafe impl NSSeguePerforming for NSPageController {}
);

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSViewController"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSPageController {}
);

#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
impl NSPageController {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSPageControllerDelegate>>>;

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

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

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

        /// Setter for [`transitionStyle`][Self::transitionStyle].
        #[unsafe(method(setTransitionStyle:))]
        #[unsafe(method_family = none)]
        pub fn setTransitionStyle(&self, transition_style: NSPageControllerTransitionStyle);

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

        /// Setter for [`arrangedObjects`][Self::arrangedObjects].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `arranged_objects` generic should be of the correct type.
        #[unsafe(method(setArrangedObjects:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setArrangedObjects(&self, arranged_objects: &NSArray);

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

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

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(navigateForwardToObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn navigateForwardToObject(&self, object: &AnyObject);

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

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(navigateBack:))]
        #[unsafe(method_family = none)]
        pub unsafe fn navigateBack(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(navigateForward:))]
        #[unsafe(method_family = none)]
        pub unsafe fn navigateForward(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(takeSelectedIndexFrom:))]
        #[unsafe(method_family = none)]
        pub unsafe fn takeSelectedIndexFrom(&self, sender: Option<&AnyObject>);
    );
}

/// Methods declared on superclass `NSViewController`.
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
impl NSPageController {
    extern_methods!(
        #[cfg(feature = "NSNib")]
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSNibName>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> 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 `NSResponder`.
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
impl NSPageController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspagecontrollerdelegate?language=objc)
    pub unsafe trait NSPageControllerDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[optional]
        #[unsafe(method(pageController:identifierForObject:))]
        #[unsafe(method_family = none)]
        unsafe fn pageController_identifierForObject(
            &self,
            page_controller: &NSPageController,
            object: &AnyObject,
        ) -> Retained<NSPageControllerObjectIdentifier>;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[optional]
        #[unsafe(method(pageController:viewControllerForIdentifier:))]
        #[unsafe(method_family = none)]
        fn pageController_viewControllerForIdentifier(
            &self,
            page_controller: &NSPageController,
            identifier: &NSPageControllerObjectIdentifier,
        ) -> Retained<NSViewController>;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[optional]
        #[unsafe(method(pageController:frameForObject:))]
        #[unsafe(method_family = none)]
        unsafe fn pageController_frameForObject(
            &self,
            page_controller: &NSPageController,
            object: Option<&AnyObject>,
        ) -> NSRect;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[optional]
        #[unsafe(method(pageController:prepareViewController:withObject:))]
        #[unsafe(method_family = none)]
        unsafe fn pageController_prepareViewController_withObject(
            &self,
            page_controller: &NSPageController,
            view_controller: &NSViewController,
            object: Option<&AnyObject>,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[optional]
        #[unsafe(method(pageController:didTransitionToObject:))]
        #[unsafe(method_family = none)]
        unsafe fn pageController_didTransitionToObject(
            &self,
            page_controller: &NSPageController,
            object: &AnyObject,
        );

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[optional]
        #[unsafe(method(pageControllerWillStartLiveTransition:))]
        #[unsafe(method_family = none)]
        fn pageControllerWillStartLiveTransition(&self, page_controller: &NSPageController);

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[optional]
        #[unsafe(method(pageControllerDidEndLiveTransition:))]
        #[unsafe(method_family = none)]
        fn pageControllerDidEndLiveTransition(&self, page_controller: &NSPageController);
    }
);
