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

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckfetchrecordzonesoperation?language=objc)
    #[unsafe(super(CKDatabaseOperation, CKOperation, NSOperation, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
    pub struct CKFetchRecordZonesOperation;
);

#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for CKFetchRecordZonesOperation {}
);

#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
impl CKFetchRecordZonesOperation {
    extern_methods!(
        #[unsafe(method(fetchAllRecordZonesOperation))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchAllRecordZonesOperation() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "CKRecordZoneID")]
        #[unsafe(method(initWithRecordZoneIDs:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRecordZoneIDs(
            this: Allocated<Self>,
            zone_i_ds: &NSArray<CKRecordZoneID>,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordZoneID")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(recordZoneIDs))]
        #[unsafe(method_family = none)]
        pub unsafe fn recordZoneIDs(&self) -> Option<Retained<NSArray<CKRecordZoneID>>>;

        #[cfg(feature = "CKRecordZoneID")]
        /// Setter for [`recordZoneIDs`][Self::recordZoneIDs].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setRecordZoneIDs:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRecordZoneIDs(&self, record_zone_i_ds: Option<&NSArray<CKRecordZoneID>>);

        #[cfg(all(
            feature = "CKRecordZone",
            feature = "CKRecordZoneID",
            feature = "block2"
        ))]
        /// Called on success or failure for each record zone.
        ///
        ///
        /// Each
        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations.
        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
        /// should not be concurrently used outside of blocks assigned to this operation.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer.
        /// - The returned block's argument 2 must be a valid pointer or null.
        /// - The returned block's argument 3 must be a valid pointer or null.
        /// - This might not be thread-safe.
        #[unsafe(method(perRecordZoneCompletionBlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn perRecordZoneCompletionBlock(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<CKRecordZoneID>, *mut CKRecordZone, *mut NSError)>;

        #[cfg(all(
            feature = "CKRecordZone",
            feature = "CKRecordZoneID",
            feature = "block2"
        ))]
        /// Setter for [`perRecordZoneCompletionBlock`][Self::perRecordZoneCompletionBlock].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setPerRecordZoneCompletionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPerRecordZoneCompletionBlock(
            &self,
            per_record_zone_completion_block: Option<
                &block2::DynBlock<dyn Fn(NonNull<CKRecordZoneID>, *mut CKRecordZone, *mut NSError)>,
            >,
        );

        #[cfg(all(
            feature = "CKRecordZone",
            feature = "CKRecordZoneID",
            feature = "block2"
        ))]
        /// This block is called when the operation completes.
        ///
        ///
        /// The
        ///
        /// ```text
        ///  -[NSOperation completionBlock]
        /// ```
        ///
        /// will also be called if both are set.
        /// If the error is
        /// `CKErrorPartialFailure,`the error's userInfo dictionary contains a dictionary of zoneIDs to errors keyed off of
        /// `CKPartialErrorsByItemIDKey.``recordZonesByZoneID`and any
        /// `CKPartialErrorsByItemIDKey`errors are repeats of the data sent back in previous
        /// `perRecordZoneCompletionBlock`invocations
        /// Each
        /// `CKOperation`instance has a private serial queue. This queue is used for all callback block invocations
        /// This block may share mutable state with other blocks assigned to this operation, but any such mutable state
        /// should not be concurrently used outside of blocks assigned to this operation.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// - The returned block's argument 1 must be a valid pointer or null.
        /// - The returned block's argument 2 must be a valid pointer or null.
        /// - This might not be thread-safe.
        #[unsafe(method(fetchRecordZonesCompletionBlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchRecordZonesCompletionBlock(
            &self,
        ) -> *mut block2::DynBlock<
            dyn Fn(*mut NSDictionary<CKRecordZoneID, CKRecordZone>, *mut NSError),
        >;

        #[cfg(all(
            feature = "CKRecordZone",
            feature = "CKRecordZoneID",
            feature = "block2"
        ))]
        /// Setter for [`fetchRecordZonesCompletionBlock`][Self::fetchRecordZonesCompletionBlock].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setFetchRecordZonesCompletionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFetchRecordZonesCompletionBlock(
            &self,
            fetch_record_zones_completion_block: Option<
                &block2::DynBlock<
                    dyn Fn(*mut NSDictionary<CKRecordZoneID, CKRecordZone>, *mut NSError),
                >,
            >,
        );
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "CKDatabaseOperation", feature = "CKOperation"))]
impl CKFetchRecordZonesOperation {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
