//! 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_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmetadataquery?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMetadataQuery;
);

unsafe impl NSObjectProtocol for NSMetadataQuery {}

impl NSMetadataQuery {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSMetadataQueryDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSMetadataQueryDelegate>>,
        );

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

        #[cfg(feature = "NSPredicate")]
        /// Setter for [`predicate`][Self::predicate].
        #[unsafe(method(setPredicate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);

        #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
        #[unsafe(method(sortDescriptors))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;

        #[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
        /// Setter for [`sortDescriptors`][Self::sortDescriptors].
        #[unsafe(method(setSortDescriptors:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);

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

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        /// Setter for [`valueListAttributes`][Self::valueListAttributes].
        #[unsafe(method(setValueListAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValueListAttributes(&self, value_list_attributes: &NSArray<NSString>);

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

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        /// Setter for [`groupingAttributes`][Self::groupingAttributes].
        #[unsafe(method(setGroupingAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setGroupingAttributes(&self, grouping_attributes: Option<&NSArray<NSString>>);

        #[cfg(feature = "NSDate")]
        #[unsafe(method(notificationBatchingInterval))]
        #[unsafe(method_family = none)]
        pub unsafe fn notificationBatchingInterval(&self) -> NSTimeInterval;

        #[cfg(feature = "NSDate")]
        /// Setter for [`notificationBatchingInterval`][Self::notificationBatchingInterval].
        #[unsafe(method(setNotificationBatchingInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setNotificationBatchingInterval(
            &self,
            notification_batching_interval: NSTimeInterval,
        );

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

        #[cfg(feature = "NSArray")]
        /// Setter for [`searchScopes`][Self::searchScopes].
        #[unsafe(method(setSearchScopes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSearchScopes(&self, search_scopes: &NSArray);

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

        #[cfg(feature = "NSArray")]
        /// Setter for [`searchItems`][Self::searchItems].
        #[unsafe(method(setSearchItems:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSearchItems(&self, search_items: Option<&NSArray>);

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

        #[cfg(feature = "NSOperation")]
        /// Setter for [`operationQueue`][Self::operationQueue].
        #[unsafe(method(setOperationQueue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setOperationQueue(&self, operation_queue: Option<&NSOperationQueue>);

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

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

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

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

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

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

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

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

        #[unsafe(method(resultAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;

        #[cfg(feature = "block2")]
        #[unsafe(method(enumerateResultsUsingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateResultsUsingBlock(
            &self,
            block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(enumerateResultsWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateResultsWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
        );

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

        #[unsafe(method(indexOfResult:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexOfResult(&self, result: &AnyObject) -> NSUInteger;

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

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

        #[cfg(feature = "NSString")]
        #[unsafe(method(valueOfAttribute:forResultAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueOfAttribute_forResultAtIndex(
            &self,
            attr_name: &NSString,
            idx: NSUInteger,
        ) -> Option<Retained<AnyObject>>;
    );
}

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmetadataquerydelegate?language=objc)
    pub unsafe trait NSMetadataQueryDelegate: NSObjectProtocol {
        #[optional]
        #[unsafe(method(metadataQuery:replacementObjectForResultObject:))]
        #[unsafe(method_family = none)]
        unsafe fn metadataQuery_replacementObjectForResultObject(
            &self,
            query: &NSMetadataQuery,
            result: &NSMetadataItem,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[optional]
        #[unsafe(method(metadataQuery:replacementValueForAttribute:value:))]
        #[unsafe(method_family = none)]
        unsafe fn metadataQuery_replacementValueForAttribute_value(
            &self,
            query: &NSMetadataQuery,
            attr_name: &NSString,
            attr_value: &AnyObject,
        ) -> Retained<AnyObject>;
    }
);

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmetadataquerydidstartgatheringnotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryDidStartGatheringNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmetadataquerygatheringprogressnotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryGatheringProgressNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmetadataquerydidfinishgatheringnotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryDidFinishGatheringNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmetadataquerydidupdatenotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSMetadataQueryDidUpdateNotification: &'static NSNotificationName;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

unsafe impl NSObjectProtocol for NSMetadataItem {}

impl NSMetadataItem {
    extern_methods!(
        #[cfg(feature = "NSURL")]
        #[unsafe(method(initWithURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;

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

        #[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(valuesForAttributes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn valuesForAttributes(
            &self,
            keys: &NSArray<NSString>,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(attributes))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributes(&self) -> Retained<NSArray<NSString>>;
    );
}

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

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

unsafe impl NSObjectProtocol for NSMetadataQueryAttributeValueTuple {}

impl NSMetadataQueryAttributeValueTuple {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(attribute))]
        #[unsafe(method_family = none)]
        pub unsafe fn attribute(&self) -> Retained<NSString>;

        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> Option<Retained<AnyObject>>;

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

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

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

unsafe impl NSObjectProtocol for NSMetadataQueryResultGroup {}

impl NSMetadataQueryResultGroup {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(attribute))]
        #[unsafe(method_family = none)]
        pub unsafe fn attribute(&self) -> Retained<NSString>;

        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> Retained<AnyObject>;

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

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

        #[unsafe(method(resultAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;

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

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