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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsportnameserver?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use NSXPCConnection instead"]
    pub struct NSPortNameServer;
);

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

impl NSPortNameServer {
    extern_methods!(
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(systemDefaultPortNameServer))]
        #[unsafe(method_family = none)]
        pub fn systemDefaultPortNameServer() -> Retained<NSPortNameServer>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:))]
        #[unsafe(method_family = none)]
        pub fn portForName(&self, name: &NSString) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:host:))]
        #[unsafe(method_family = none)]
        pub fn portForName_host(
            &self,
            name: &NSString,
            host: Option<&NSString>,
        ) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(registerPort:name:))]
        #[unsafe(method_family = none)]
        pub fn registerPort_name(&self, port: &NSPort, name: &NSString) -> bool;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(removePortForName:))]
        #[unsafe(method_family = none)]
        pub fn removePortForName(&self, name: &NSString) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSPortNameServer {
    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() -> Retained<Self>;
    );
}

impl DefaultRetained for NSPortNameServer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmachbootstrapserver?language=objc)
    #[unsafe(super(NSPortNameServer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use NSXPCConnection instead"]
    pub struct NSMachBootstrapServer;
);

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

impl NSMachBootstrapServer {
    extern_methods!(
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(sharedInstance))]
        #[unsafe(method_family = none)]
        pub fn sharedInstance() -> Retained<AnyObject>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:))]
        #[unsafe(method_family = none)]
        pub fn portForName(&self, name: &NSString) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:host:))]
        #[unsafe(method_family = none)]
        pub fn portForName_host(
            &self,
            name: &NSString,
            host: Option<&NSString>,
        ) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(registerPort:name:))]
        #[unsafe(method_family = none)]
        pub fn registerPort_name(&self, port: &NSPort, name: &NSString) -> bool;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[unsafe(method(servicePortWithName:))]
        #[unsafe(method_family = none)]
        pub fn servicePortWithName(&self, name: &NSString) -> Option<Retained<NSPort>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMachBootstrapServer {
    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() -> Retained<Self>;
    );
}

impl DefaultRetained for NSMachBootstrapServer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmessageportnameserver?language=objc)
    #[unsafe(super(NSPortNameServer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use NSXPCConnection instead"]
    pub struct NSMessagePortNameServer;
);

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

impl NSMessagePortNameServer {
    extern_methods!(
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(sharedInstance))]
        #[unsafe(method_family = none)]
        pub fn sharedInstance() -> Retained<AnyObject>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:))]
        #[unsafe(method_family = none)]
        pub fn portForName(&self, name: &NSString) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:host:))]
        #[unsafe(method_family = none)]
        pub fn portForName_host(
            &self,
            name: &NSString,
            host: Option<&NSString>,
        ) -> Option<Retained<NSPort>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMessagePortNameServer {
    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() -> Retained<Self>;
    );
}

impl DefaultRetained for NSMessagePortNameServer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nssocketportnameserver?language=objc)
    #[unsafe(super(NSPortNameServer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use NSXPCConnection instead"]
    pub struct NSSocketPortNameServer;
);

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

impl NSSocketPortNameServer {
    extern_methods!(
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(sharedInstance))]
        #[unsafe(method_family = none)]
        pub fn sharedInstance() -> Retained<AnyObject>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:))]
        #[unsafe(method_family = none)]
        pub fn portForName(&self, name: &NSString) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:host:))]
        #[unsafe(method_family = none)]
        pub fn portForName_host(
            &self,
            name: &NSString,
            host: Option<&NSString>,
        ) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(registerPort:name:))]
        #[unsafe(method_family = none)]
        pub fn registerPort_name(&self, port: &NSPort, name: &NSString) -> bool;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(removePortForName:))]
        #[unsafe(method_family = none)]
        pub fn removePortForName(&self, name: &NSString) -> bool;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(portForName:host:nameServerPortNumber:))]
        #[unsafe(method_family = none)]
        pub fn portForName_host_nameServerPortNumber(
            &self,
            name: &NSString,
            host: Option<&NSString>,
            port_number: u16,
        ) -> Option<Retained<NSPort>>;

        #[cfg(all(feature = "NSPort", feature = "NSString"))]
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(registerPort:name:nameServerPortNumber:))]
        #[unsafe(method_family = none)]
        pub fn registerPort_name_nameServerPortNumber(
            &self,
            port: &NSPort,
            name: &NSString,
            port_number: u16,
        ) -> bool;

        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(defaultNameServerPortNumber))]
        #[unsafe(method_family = none)]
        pub fn defaultNameServerPortNumber(&self) -> u16;

        /// Setter for [`defaultNameServerPortNumber`][Self::defaultNameServerPortNumber].
        #[deprecated = "Use NSXPCConnection instead"]
        #[unsafe(method(setDefaultNameServerPortNumber:))]
        #[unsafe(method_family = none)]
        pub fn setDefaultNameServerPortNumber(&self, default_name_server_port_number: u16);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSSocketPortNameServer {
    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() -> Retained<Self>;
    );
}

impl DefaultRetained for NSSocketPortNameServer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
