//! 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::*;
#[cfg(feature = "objc2-security-foundation")]
use objc2_security_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketsigningdisabled?language=objc)
pub const ODPacketSigningDisabled: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketsigningallow?language=objc)
pub const ODPacketSigningAllow: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketsigningrequired?language=objc)
pub const ODPacketSigningRequired: c_uint = 2;

/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptiondisabled?language=objc)
pub const ODPacketEncryptionDisabled: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptionallow?language=objc)
pub const ODPacketEncryptionAllow: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptionrequired?language=objc)
pub const ODPacketEncryptionRequired: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptionssl?language=objc)
pub const ODPacketEncryptionSSL: c_uint = 3;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odtrusttypejoined?language=objc)
    pub static ODTrustTypeJoined: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odtrusttypeusingcredentials?language=objc)
    pub static ODTrustTypeUsingCredentials: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odtrusttypeanonymous?language=objc)
    pub static ODTrustTypeAnonymous: Option<&'static NSString>;
}

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

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

impl ODConfiguration {
    extern_methods!(
        #[unsafe(method(nodeName))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeName(&self) -> Retained<NSString>;

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

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

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

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

        #[cfg(feature = "ODMappings")]
        /// Setter for [`defaultMappings`][Self::defaultMappings].
        ///
        /// # Safety
        ///
        /// `default_mappings` might not allow `None`.
        #[unsafe(method(setDefaultMappings:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDefaultMappings(&self, default_mappings: Option<&ODMappings>);

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

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

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

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

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

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

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

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

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

        /// Setter for [`preferredDestinationHostPort`][Self::preferredDestinationHostPort].
        #[unsafe(method(setPreferredDestinationHostPort:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreferredDestinationHostPort(&self, preferred_destination_host_port: u16);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        /// Returns an initialized and autoreleased ODConfiguration object.
        ///
        ///
        /// Returns an initialized and autoreleased ODConfiguration object.
        #[unsafe(method(configuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn configuration() -> Option<Retained<Self>>;

        /// Returns a suggested name to use for the trust account.
        ///
        ///
        /// Returns a suggested name to use for a trust account.  This name will be derived from the hostname
        /// (if provided), otherwise it will be derived from the local hostname removing special characters
        /// that may not be allowed by many systems.
        ///
        /// # Safety
        ///
        /// `hostname` might not allow `None`.
        #[unsafe(method(suggestedTrustAccount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn suggestedTrustAccount(
            hostname: Option<&NSString>,
        ) -> Option<Retained<NSString>>;

        /// Returns a suggested password to be used for trust account with the requested length.
        ///
        ///
        /// Returns a suggested password to be used for trust account with the requested length.
        #[unsafe(method(suggestedTrustPassword:))]
        #[unsafe(method_family = none)]
        pub unsafe fn suggestedTrustPassword(length: usize) -> Option<Retained<NSString>>;

        #[cfg(feature = "objc2-security-foundation")]
        /// Saves the configuration using the provided authorization.
        ///
        ///
        /// Saves the configuration using the provided authorization.
        ///
        /// # Safety
        ///
        /// - `authorization` might not allow `None`.
        /// - `error` might not allow `None`.
        #[unsafe(method(saveUsingAuthorization:error:))]
        #[unsafe(method_family = none)]
        pub unsafe fn saveUsingAuthorization_error(
            &self,
            authorization: Option<&SFAuthorization>,
            error: Option<&mut Option<Retained<NSError>>>,
        ) -> bool;

        /// Adds a trust account with the provided name and password using the credentials provided by the user.
        ///
        ///
        /// Adds a trust account with the provided name and password using the credentials provided by the user.  User can
        /// request that the trust be forcibly created (replacing existing trust if found in directory).  A trust should be
        /// established only after enough configuration is available and the configuration been saved.  If the trust is
        /// required, then the configuration can be deleted if necessary upon failure.
        ///
        /// # Safety
        ///
        /// - `trust_type` might not allow `None`.
        /// - `account` might not allow `None`.
        /// - `account_password` might not allow `None`.
        /// - `username` might not allow `None`.
        /// - `password` might not allow `None`.
        /// - `error` might not allow `None`.
        #[unsafe(method(addTrustType:trustAccount:trustPassword:username:password:joinExisting:error:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addTrustType_trustAccount_trustPassword_username_password_joinExisting_error(
            &self,
            trust_type: Option<&NSString>,
            account: Option<&NSString>,
            account_password: Option<&NSString>,
            username: Option<&NSString>,
            password: Option<&NSString>,
            join: bool,
            error: Option<&mut Option<Retained<NSError>>>,
        ) -> bool;

        /// Removes trust using the provided username and password.
        ///
        ///
        /// Removes trust using the provided username and password.  The trust account will be removed from the directory only if requested.
        ///
        /// # Safety
        ///
        /// - `username` might not allow `None`.
        /// - `password` might not allow `None`.
        /// - `error` might not allow `None`.
        #[unsafe(method(removeTrustUsingUsername:password:deleteTrustAccount:error:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeTrustUsingUsername_password_deleteTrustAccount_error(
            &self,
            username: Option<&NSString>,
            password: Option<&NSString>,
            delete_account: bool,
            error: Option<&mut Option<Retained<NSError>>>,
        ) -> bool;
    );
}

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