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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogresskind?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSProgressKind = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressuserinfokey?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSProgressUserInfoKey = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkind?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSProgressFileOperationKind = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressunpublishinghandler?language=objc)
#[cfg(feature = "block2")]
pub type NSProgressUnpublishingHandler = *mut block2::DynBlock<dyn Fn()>;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogresspublishinghandler?language=objc)
#[cfg(feature = "block2")]
pub type NSProgressPublishingHandler =
    *mut block2::DynBlock<dyn Fn(NonNull<NSProgress>) -> NSProgressUnpublishingHandler>;

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

unsafe impl Send for NSProgress {}

unsafe impl Sync for NSProgress {}

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

impl NSProgress {
    extern_methods!(
        #[unsafe(method(currentProgress))]
        #[unsafe(method_family = none)]
        pub fn currentProgress() -> Option<Retained<NSProgress>>;

        #[unsafe(method(progressWithTotalUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn progressWithTotalUnitCount(unit_count: i64) -> Retained<NSProgress>;

        #[unsafe(method(discreteProgressWithTotalUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn discreteProgressWithTotalUnitCount(unit_count: i64) -> Retained<NSProgress>;

        #[unsafe(method(progressWithTotalUnitCount:parent:pendingUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn progressWithTotalUnitCount_parent_pendingUnitCount(
            unit_count: i64,
            parent: &NSProgress,
            portion_of_parent_total_unit_count: i64,
        ) -> Retained<NSProgress>;

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        /// # Safety
        ///
        /// `user_info_or_nil` generic should be of the correct type.
        #[unsafe(method(initWithParent:userInfo:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithParent_userInfo(
            this: Allocated<Self>,
            parent_progress_or_nil: Option<&NSProgress>,
            user_info_or_nil: Option<&NSDictionary<NSProgressUserInfoKey, AnyObject>>,
        ) -> Retained<Self>;

        #[unsafe(method(becomeCurrentWithPendingUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn becomeCurrentWithPendingUnitCount(&self, unit_count: i64);

        #[cfg(feature = "block2")]
        #[unsafe(method(performAsCurrentWithPendingUnitCount:usingBlock:))]
        #[unsafe(method_family = none)]
        pub fn performAsCurrentWithPendingUnitCount_usingBlock(
            &self,
            unit_count: i64,
            work: &block2::DynBlock<dyn Fn() + '_>,
        );

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

        #[unsafe(method(addChild:withPendingUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn addChild_withPendingUnitCount(&self, child: &NSProgress, in_unit_count: i64);

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

        /// Setter for [`totalUnitCount`][Self::totalUnitCount].
        #[unsafe(method(setTotalUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn setTotalUnitCount(&self, total_unit_count: i64);

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

        /// Setter for [`completedUnitCount`][Self::completedUnitCount].
        #[unsafe(method(setCompletedUnitCount:))]
        #[unsafe(method_family = none)]
        pub fn setCompletedUnitCount(&self, completed_unit_count: i64);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`localizedDescription`][Self::localizedDescription].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setLocalizedDescription:))]
        #[unsafe(method_family = none)]
        pub fn setLocalizedDescription(&self, localized_description: Option<&NSString>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`localizedAdditionalDescription`][Self::localizedAdditionalDescription].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setLocalizedAdditionalDescription:))]
        #[unsafe(method_family = none)]
        pub fn setLocalizedAdditionalDescription(
            &self,
            localized_additional_description: Option<&NSString>,
        );

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

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

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

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

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

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

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block must be sendable.
        #[unsafe(method(cancellationHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancellationHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;

        #[cfg(feature = "block2")]
        /// Setter for [`cancellationHandler`][Self::cancellationHandler].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `cancellation_handler` block must be sendable.
        #[unsafe(method(setCancellationHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCancellationHandler(
            &self,
            cancellation_handler: Option<&block2::DynBlock<dyn Fn()>>,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block must be sendable.
        #[unsafe(method(pausingHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn pausingHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;

        #[cfg(feature = "block2")]
        /// Setter for [`pausingHandler`][Self::pausingHandler].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `pausing_handler` block must be sendable.
        #[unsafe(method(setPausingHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPausingHandler(
            &self,
            pausing_handler: Option<&block2::DynBlock<dyn Fn()>>,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block must be sendable.
        #[unsafe(method(resumingHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn resumingHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;

        #[cfg(feature = "block2")]
        /// Setter for [`resumingHandler`][Self::resumingHandler].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `resuming_handler` block must be sendable.
        #[unsafe(method(setResumingHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setResumingHandler(
            &self,
            resuming_handler: Option<&block2::DynBlock<dyn Fn()>>,
        );

        #[cfg(feature = "NSString")]
        /// # Safety
        ///
        /// `object_or_nil` should be of the correct type.
        #[unsafe(method(setUserInfoObject:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInfoObject_forKey(
            &self,
            object_or_nil: Option<&AnyObject>,
            key: &NSProgressUserInfoKey,
        );

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

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

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

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

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

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

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(userInfo))]
        #[unsafe(method_family = none)]
        pub fn userInfo(&self) -> Retained<NSDictionary<NSProgressUserInfoKey, AnyObject>>;

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

        #[cfg(feature = "NSString")]
        /// Setter for [`kind`][Self::kind].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setKind:))]
        #[unsafe(method_family = none)]
        pub fn setKind(&self, kind: Option<&NSProgressKind>);

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

        #[cfg(feature = "NSValue")]
        /// Setter for [`estimatedTimeRemaining`][Self::estimatedTimeRemaining].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setEstimatedTimeRemaining:))]
        #[unsafe(method_family = none)]
        pub fn setEstimatedTimeRemaining(&self, estimated_time_remaining: Option<&NSNumber>);

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

        #[cfg(feature = "NSValue")]
        /// Setter for [`throughput`][Self::throughput].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setThroughput:))]
        #[unsafe(method_family = none)]
        pub fn setThroughput(&self, throughput: Option<&NSNumber>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`fileOperationKind`][Self::fileOperationKind].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setFileOperationKind:))]
        #[unsafe(method_family = none)]
        pub fn setFileOperationKind(
            &self,
            file_operation_kind: Option<&NSProgressFileOperationKind>,
        );

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

        #[cfg(feature = "NSURL")]
        /// Setter for [`fileURL`][Self::fileURL].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setFileURL:))]
        #[unsafe(method_family = none)]
        pub fn setFileURL(&self, file_url: Option<&NSURL>);

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

        #[cfg(feature = "NSValue")]
        /// Setter for [`fileTotalCount`][Self::fileTotalCount].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setFileTotalCount:))]
        #[unsafe(method_family = none)]
        pub fn setFileTotalCount(&self, file_total_count: Option<&NSNumber>);

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

        #[cfg(feature = "NSValue")]
        /// Setter for [`fileCompletedCount`][Self::fileCompletedCount].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setFileCompletedCount:))]
        #[unsafe(method_family = none)]
        pub fn setFileCompletedCount(&self, file_completed_count: Option<&NSNumber>);

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

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

        #[cfg(all(feature = "NSURL", feature = "block2"))]
        /// # Safety
        ///
        /// `publishing_handler` must be a valid pointer.
        #[unsafe(method(addSubscriberForFileURL:withPublishingHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addSubscriberForFileURL_withPublishingHandler(
            url: &NSURL,
            publishing_handler: NSProgressPublishingHandler,
        ) -> Retained<AnyObject>;

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

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressreporting?language=objc)
    pub unsafe trait NSProgressReporting: NSObjectProtocol {
        #[unsafe(method(progress))]
        #[unsafe(method_family = none)]
        fn progress(&self) -> Retained<NSProgress>;
    }
);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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