//! 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 "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertystatuscodekey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSHTTPPropertyStatusCodeKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertystatusreasonkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSHTTPPropertyStatusReasonKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyserverhttpversionkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSHTTPPropertyServerHTTPVersionKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyredirectionheaderskey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSHTTPPropertyRedirectionHeadersKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyerrorpagedatakey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSHTTPPropertyErrorPageDataKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyhttpproxy?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSHTTPPropertyHTTPProxy: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyuserloginkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSFTPPropertyUserLoginKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyuserpasswordkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSFTPPropertyUserPasswordKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyactivetransfermodekey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSFTPPropertyActiveTransferModeKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyfileoffsetkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSFTPPropertyFileOffsetKey: Option<&'static NSString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyftpproxy?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSFTPPropertyFTPProxy: Option<&'static NSString>;
}

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlhandlestatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSURLHandleStatus(pub NSUInteger);
impl NSURLHandleStatus {
    #[doc(alias = "NSURLHandleNotLoaded")]
    pub const NotLoaded: Self = Self(0);
    #[doc(alias = "NSURLHandleLoadSucceeded")]
    pub const LoadSucceeded: Self = Self(1);
    #[doc(alias = "NSURLHandleLoadInProgress")]
    pub const LoadInProgress: Self = Self(2);
    #[doc(alias = "NSURLHandleLoadFailed")]
    pub const LoadFailed: Self = Self(3);
}

unsafe impl Encode for NSURLHandleStatus {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlhandleclient?language=objc)
    #[deprecated]
    pub unsafe trait NSURLHandleClient {
        #[cfg(feature = "NSData")]
        #[deprecated]
        #[unsafe(method(URLHandle:resourceDataDidBecomeAvailable:))]
        #[unsafe(method_family = none)]
        unsafe fn URLHandle_resourceDataDidBecomeAvailable(
            &self,
            sender: Option<&NSURLHandle>,
            new_bytes: Option<&NSData>,
        );

        #[deprecated]
        #[unsafe(method(URLHandleResourceDidBeginLoading:))]
        #[unsafe(method_family = none)]
        unsafe fn URLHandleResourceDidBeginLoading(&self, sender: Option<&NSURLHandle>);

        #[deprecated]
        #[unsafe(method(URLHandleResourceDidFinishLoading:))]
        #[unsafe(method_family = none)]
        unsafe fn URLHandleResourceDidFinishLoading(&self, sender: Option<&NSURLHandle>);

        #[deprecated]
        #[unsafe(method(URLHandleResourceDidCancelLoading:))]
        #[unsafe(method_family = none)]
        unsafe fn URLHandleResourceDidCancelLoading(&self, sender: Option<&NSURLHandle>);

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(URLHandle:resourceDidFailLoadingWithReason:))]
        #[unsafe(method_family = none)]
        unsafe fn URLHandle_resourceDidFailLoadingWithReason(
            &self,
            sender: Option<&NSURLHandle>,
            reason: Option<&NSString>,
        );
    }
);

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

unsafe impl NSObjectProtocol for NSURLHandle {}

impl NSURLHandle {
    extern_methods!(
        #[deprecated]
        #[unsafe(method(registerURLHandleClass:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registerURLHandleClass(an_url_handle_subclass: Option<&AnyClass>);

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(URLHandleClassForURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLHandleClassForURL(an_url: Option<&NSURL>) -> Option<&'static AnyClass>;

        #[deprecated]
        #[unsafe(method(status))]
        #[unsafe(method_family = none)]
        pub unsafe fn status(&self) -> NSURLHandleStatus;

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

        #[deprecated]
        #[unsafe(method(addClient:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);

        #[deprecated]
        #[unsafe(method(removeClient:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);

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

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

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

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

        #[deprecated]
        #[unsafe(method(expectedResourceDataSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn expectedResourceDataSize(&self) -> c_longlong;

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

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(backgroundLoadDidFailWithReason:))]
        #[unsafe(method_family = none)]
        pub unsafe fn backgroundLoadDidFailWithReason(&self, reason: Option<&NSString>);

        #[cfg(feature = "NSData")]
        #[deprecated]
        #[unsafe(method(didLoadBytes:loadComplete:))]
        #[unsafe(method_family = none)]
        pub unsafe fn didLoadBytes_loadComplete(&self, new_bytes: Option<&NSData>, yorn: bool);

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(canInitWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn canInitWithURL(an_url: Option<&NSURL>) -> bool;

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(cachedHandleForURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cachedHandleForURL(an_url: Option<&NSURL>) -> Option<Retained<NSURLHandle>>;

        #[cfg(feature = "NSURL")]
        #[deprecated]
        #[unsafe(method(initWithURL:cached:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL_cached(
            this: Allocated<Self>,
            an_url: Option<&NSURL>,
            will_cache: bool,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(propertyForKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn propertyForKey(
            &self,
            property_key: Option<&NSString>,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(propertyForKeyIfAvailable:))]
        #[unsafe(method_family = none)]
        pub unsafe fn propertyForKeyIfAvailable(
            &self,
            property_key: Option<&NSString>,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(writeProperty:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn writeProperty_forKey(
            &self,
            property_value: Option<&AnyObject>,
            property_key: Option<&NSString>,
        ) -> bool;

        #[cfg(feature = "NSData")]
        #[deprecated]
        #[unsafe(method(writeData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn writeData(&self, data: Option<&NSData>) -> bool;

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

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

        #[deprecated]
        #[unsafe(method(endLoadInBackground))]
        #[unsafe(method_family = none)]
        pub unsafe fn endLoadInBackground(&self);
    );
}

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