//! 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 NSFileVersionAddingOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFileVersionAddingOptions: NSUInteger {
        const NSFileVersionAddingByMoving = 1<<0;
    }
}

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

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileVersionReplacingOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSFileVersionReplacingOptions: NSUInteger {
        const NSFileVersionReplacingByMoving = 1<<0;
    }
}

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

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

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

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

unsafe impl NSObjectProtocol for NSFileVersion {}

extern_methods!(
    unsafe impl NSFileVersion {
        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other currentVersionOfItemAtURL:)]
        pub unsafe fn currentVersionOfItemAtURL(url: &NSURL) -> Option<Retained<NSFileVersion>>;

        #[cfg(all(feature = "NSArray", feature = "NSURL"))]
        #[method_id(@__retain_semantics Other otherVersionsOfItemAtURL:)]
        pub unsafe fn otherVersionsOfItemAtURL(
            url: &NSURL,
        ) -> Option<Retained<NSArray<NSFileVersion>>>;

        #[cfg(all(feature = "NSArray", feature = "NSURL"))]
        #[method_id(@__retain_semantics Other unresolvedConflictVersionsOfItemAtURL:)]
        pub unsafe fn unresolvedConflictVersionsOfItemAtURL(
            url: &NSURL,
        ) -> Option<Retained<NSArray<NSFileVersion>>>;

        #[cfg(all(
            feature = "NSArray",
            feature = "NSError",
            feature = "NSURL",
            feature = "block2"
        ))]
        #[method(getNonlocalVersionsOfItemAtURL:completionHandler:)]
        pub unsafe fn getNonlocalVersionsOfItemAtURL_completionHandler(
            url: &NSURL,
            completion_handler: &block2::Block<dyn Fn(*mut NSArray<NSFileVersion>, *mut NSError)>,
        );

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other versionOfItemAtURL:forPersistentIdentifier:)]
        pub unsafe fn versionOfItemAtURL_forPersistentIdentifier(
            url: &NSURL,
            persistent_identifier: &AnyObject,
        ) -> Option<Retained<NSFileVersion>>;

        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[method_id(@__retain_semantics Other addVersionOfItemAtURL:withContentsOfURL:options:error:_)]
        pub unsafe fn addVersionOfItemAtURL_withContentsOfURL_options_error(
            url: &NSURL,
            contents_url: &NSURL,
            options: NSFileVersionAddingOptions,
        ) -> Result<Retained<NSFileVersion>, Retained<NSError>>;

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other temporaryDirectoryURLForNewVersionOfItemAtURL:)]
        pub unsafe fn temporaryDirectoryURLForNewVersionOfItemAtURL(url: &NSURL)
            -> Retained<NSURL>;

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

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

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

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

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

        #[cfg(feature = "NSObject")]
        #[method_id(@__retain_semantics Other persistentIdentifier)]
        pub unsafe fn persistentIdentifier(&self) -> Retained<ProtocolObject<dyn NSCoding>>;

        #[method(isConflict)]
        pub unsafe fn isConflict(&self) -> bool;

        #[method(isResolved)]
        pub unsafe fn isResolved(&self) -> bool;

        #[method(setResolved:)]
        pub unsafe fn setResolved(&self, resolved: bool);

        #[method(isDiscardable)]
        pub unsafe fn isDiscardable(&self) -> bool;

        #[method(setDiscardable:)]
        pub unsafe fn setDiscardable(&self, discardable: bool);

        #[method(hasLocalContents)]
        pub unsafe fn hasLocalContents(&self) -> bool;

        #[method(hasThumbnail)]
        pub unsafe fn hasThumbnail(&self) -> bool;

        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[method_id(@__retain_semantics Other replaceItemAtURL:options:error:_)]
        pub unsafe fn replaceItemAtURL_options_error(
            &self,
            url: &NSURL,
            options: NSFileVersionReplacingOptions,
        ) -> Result<Retained<NSURL>, Retained<NSError>>;

        #[cfg(feature = "NSError")]
        #[method(removeAndReturnError:_)]
        pub unsafe fn removeAndReturnError(&self) -> Result<(), Retained<NSError>>;

        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[method(removeOtherVersionsOfItemAtURL:error:_)]
        pub unsafe fn removeOtherVersionsOfItemAtURL_error(
            url: &NSURL,
        ) -> Result<(), Retained<NSError>>;
    }
);

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