//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileCoordinatorReadingOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFileCoordinatorReadingOptions: NSUInteger {
        const NSFileCoordinatorReadingWithoutChanges = 1<<0;
        const NSFileCoordinatorReadingResolvesSymbolicLink = 1<<1;
        const NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly = 1<<2;
        const NSFileCoordinatorReadingForUploading = 1<<3;
    }
}

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

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileCoordinatorWritingOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFileCoordinatorWritingOptions: NSUInteger {
        const NSFileCoordinatorWritingForDeleting = 1<<0;
        const NSFileCoordinatorWritingForMoving = 1<<1;
        const NSFileCoordinatorWritingForMerging = 1<<2;
        const NSFileCoordinatorWritingForReplacing = 1<<3;
        const NSFileCoordinatorWritingContentIndependentMetadataOnly = 1<<4;
    }
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFileAccessIntent;

    unsafe impl ClassType for NSFileAccessIntent {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for NSFileAccessIntent {}

unsafe impl Sync for NSFileAccessIntent {}

unsafe impl NSObjectProtocol for NSFileAccessIntent {}

extern_methods!(
    unsafe impl NSFileAccessIntent {
        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other readingIntentWithURL:options:)]
        pub unsafe fn readingIntentWithURL_options(
            url: &NSURL,
            options: NSFileCoordinatorReadingOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other writingIntentWithURL:options:)]
        pub unsafe fn writingIntentWithURL_options(
            url: &NSURL,
            options: NSFileCoordinatorWritingOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other URL)]
        pub unsafe fn URL(&self) -> Retained<NSURL>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSFileAccessIntent {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFileCoordinator;

    unsafe impl ClassType for NSFileCoordinator {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSFileCoordinator {}

extern_methods!(
    unsafe impl NSFileCoordinator {
        #[cfg(feature = "NSFilePresenter")]
        #[method(addFilePresenter:)]
        pub unsafe fn addFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);

        #[cfg(feature = "NSFilePresenter")]
        #[method(removeFilePresenter:)]
        pub unsafe fn removeFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);

        #[cfg(all(feature = "NSArray", feature = "NSFilePresenter"))]
        #[method_id(@__retain_semantics Other filePresenters)]
        pub unsafe fn filePresenters() -> Retained<NSArray<ProtocolObject<dyn NSFilePresenter>>>;

        #[cfg(feature = "NSFilePresenter")]
        #[method_id(@__retain_semantics Init initWithFilePresenter:)]
        pub unsafe fn initWithFilePresenter(
            this: Allocated<Self>,
            file_presenter_or_nil: Option<&ProtocolObject<dyn NSFilePresenter>>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other purposeIdentifier)]
        pub unsafe fn purposeIdentifier(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method(setPurposeIdentifier:)]
        pub unsafe fn setPurposeIdentifier(&self, purpose_identifier: &NSString);

        #[cfg(all(
            feature = "NSArray",
            feature = "NSError",
            feature = "NSOperation",
            feature = "block2"
        ))]
        #[method(coordinateAccessWithIntents:queue:byAccessor:)]
        pub unsafe fn coordinateAccessWithIntents_queue_byAccessor(
            &self,
            intents: &NSArray<NSFileAccessIntent>,
            queue: &NSOperationQueue,
            accessor: &block2::Block<dyn Fn(*mut NSError)>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateReadingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateReadingItemAtURL_options_error_byAccessor(
            &self,
            url: &NSURL,
            options: NSFileCoordinatorReadingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            reader: &block2::Block<dyn Fn(NonNull<NSURL>) + '_>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateWritingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateWritingItemAtURL_options_error_byAccessor(
            &self,
            url: &NSURL,
            options: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            writer: &block2::Block<dyn Fn(NonNull<NSURL>) + '_>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateReadingItemAtURL:options:writingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateReadingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
            &self,
            reading_url: &NSURL,
            reading_options: NSFileCoordinatorReadingOptions,
            writing_url: &NSURL,
            writing_options: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            reader_writer: &block2::Block<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
        );

        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
        #[method(coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor:)]
        pub unsafe fn coordinateWritingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
            &self,
            url1: &NSURL,
            options1: NSFileCoordinatorWritingOptions,
            url2: &NSURL,
            options2: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            writer: &block2::Block<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
        );

        #[cfg(all(
            feature = "NSArray",
            feature = "NSError",
            feature = "NSURL",
            feature = "block2"
        ))]
        #[method(prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:)]
        pub unsafe fn prepareForReadingItemsAtURLs_options_writingItemsAtURLs_options_error_byAccessor(
            &self,
            reading_ur_ls: &NSArray<NSURL>,
            reading_options: NSFileCoordinatorReadingOptions,
            writing_ur_ls: &NSArray<NSURL>,
            writing_options: NSFileCoordinatorWritingOptions,
            out_error: Option<&mut Option<Retained<NSError>>>,
            batch_accessor: &block2::Block<dyn Fn(NonNull<block2::Block<dyn Fn()>>) + '_>,
        );

        #[cfg(feature = "NSURL")]
        #[method(itemAtURL:willMoveToURL:)]
        pub unsafe fn itemAtURL_willMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);

        #[cfg(feature = "NSURL")]
        #[method(itemAtURL:didMoveToURL:)]
        pub unsafe fn itemAtURL_didMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);

        #[cfg(all(feature = "NSSet", feature = "NSString", feature = "NSURL"))]
        #[method(itemAtURL:didChangeUbiquityAttributes:)]
        pub unsafe fn itemAtURL_didChangeUbiquityAttributes(
            &self,
            url: &NSURL,
            attributes: &NSSet<NSURLResourceKey>,
        );

        #[method(cancel)]
        pub unsafe fn cancel(&self);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSFileCoordinator {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);
