//! 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/coredata/nspersistenthistorychangerequest?language=objc)
    #[unsafe(super(NSPersistentStoreRequest, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSPersistentStoreRequest")]
    pub struct NSPersistentHistoryChangeRequest;
);

#[cfg(feature = "NSPersistentStoreRequest")]
extern_conformance!(
    unsafe impl NSCopying for NSPersistentHistoryChangeRequest {}
);

#[cfg(feature = "NSPersistentStoreRequest")]
unsafe impl CopyingHelper for NSPersistentHistoryChangeRequest {
    type Result = Self;
}

#[cfg(feature = "NSPersistentStoreRequest")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSPersistentHistoryChangeRequest {}
);

#[cfg(feature = "NSPersistentStoreRequest")]
impl NSPersistentHistoryChangeRequest {
    extern_methods!(
        #[unsafe(method(fetchHistoryAfterDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchHistoryAfterDate(date: &NSDate) -> Retained<Self>;

        #[cfg(feature = "NSPersistentHistoryToken")]
        #[unsafe(method(fetchHistoryAfterToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchHistoryAfterToken(
            token: Option<&NSPersistentHistoryToken>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSPersistentHistoryTransaction")]
        #[unsafe(method(fetchHistoryAfterTransaction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchHistoryAfterTransaction(
            transaction: Option<&NSPersistentHistoryTransaction>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSFetchRequest")]
        /// # Safety
        ///
        /// `fetch_request` generic should be bound by `NSFetchRequestResult`.
        #[unsafe(method(fetchHistoryWithFetchRequest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchHistoryWithFetchRequest(
            fetch_request: &NSFetchRequest,
        ) -> Retained<Self>;

        #[unsafe(method(deleteHistoryBeforeDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteHistoryBeforeDate(date: &NSDate) -> Retained<Self>;

        #[cfg(feature = "NSPersistentHistoryToken")]
        #[unsafe(method(deleteHistoryBeforeToken:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteHistoryBeforeToken(
            token: Option<&NSPersistentHistoryToken>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSPersistentHistoryTransaction")]
        #[unsafe(method(deleteHistoryBeforeTransaction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deleteHistoryBeforeTransaction(
            transaction: Option<&NSPersistentHistoryTransaction>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSPersistentStoreResult")]
        #[unsafe(method(resultType))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultType(&self) -> NSPersistentHistoryResultType;

        #[cfg(feature = "NSPersistentStoreResult")]
        /// Setter for [`resultType`][Self::resultType].
        #[unsafe(method(setResultType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setResultType(&self, result_type: NSPersistentHistoryResultType);

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

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

        #[cfg(feature = "NSFetchRequest")]
        /// Setter for [`fetchRequest`][Self::fetchRequest].
        ///
        /// # Safety
        ///
        /// `fetch_request` generic should be bound by `NSFetchRequestResult`.
        #[unsafe(method(setFetchRequest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFetchRequest(&self, fetch_request: Option<&NSFetchRequest>);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSPersistentStoreRequest")]
impl NSPersistentHistoryChangeRequest {
    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>;
    );
}
