//! 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!(
    /// DEPRECATION NOTICE
    ///
    /// If you’re using `NSHost` to resolve DNS names so that you can connect to a
    /// service, switch to a connect-by-name API, for example, `nw_connection`.
    ///
    /// If you have other DNS resolution needs, switch to
    /// <dns
    /// _sd.h>.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nshost?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
    pub struct NSHost;
);

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

impl NSHost {
    extern_methods!(
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(currentHost))]
        #[unsafe(method_family = none)]
        pub fn currentHost() -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(hostWithName:))]
        #[unsafe(method_family = none)]
        pub fn hostWithName(name: Option<&NSString>) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(hostWithAddress:))]
        #[unsafe(method_family = none)]
        pub fn hostWithAddress(address: &NSString) -> Retained<Self>;

        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(isEqualToHost:))]
        #[unsafe(method_family = none)]
        pub fn isEqualToHost(&self, a_host: &NSHost) -> bool;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(names))]
        #[unsafe(method_family = none)]
        pub fn names(&self) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(address))]
        #[unsafe(method_family = none)]
        pub fn address(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
        #[unsafe(method(addresses))]
        #[unsafe(method_family = none)]
        pub fn addresses(&self) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(localizedName))]
        #[unsafe(method_family = none)]
        pub fn localizedName(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Caching no longer supported"]
        #[unsafe(method(setHostCacheEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setHostCacheEnabled(flag: bool);

        #[deprecated = "Caching no longer supported"]
        #[unsafe(method(isHostCacheEnabled))]
        #[unsafe(method_family = none)]
        pub fn isHostCacheEnabled() -> bool;

        #[deprecated = "Caching no longer supported"]
        #[unsafe(method(flushHostCache))]
        #[unsafe(method_family = none)]
        pub fn flushHostCache();
    );
}

/// Methods declared on superclass `NSObject`.
impl NSHost {
    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 NSHost {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
