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

use crate::*;

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

unsafe impl Send for NSDateInterval {}

unsafe impl Sync for NSDateInterval {}

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSDateInterval {}
);

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

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

extern_conformance!(
    unsafe impl NSObjectProtocol for NSDateInterval {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSDateInterval {}
);

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

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

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

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

        #[cfg(feature = "NSCoder")]
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(initWithStartDate:duration:))]
        #[unsafe(method_family = init)]
        pub fn initWithStartDate_duration(
            this: Allocated<Self>,
            start_date: &NSDate,
            duration: NSTimeInterval,
        ) -> Retained<Self>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(initWithStartDate:endDate:))]
        #[unsafe(method_family = init)]
        pub fn initWithStartDate_endDate(
            this: Allocated<Self>,
            start_date: &NSDate,
            end_date: &NSDate,
        ) -> Retained<Self>;

        #[cfg(feature = "NSObjCRuntime")]
        #[unsafe(method(compare:))]
        #[unsafe(method_family = none)]
        pub fn compare(&self, date_interval: &NSDateInterval) -> NSComparisonResult;

        #[unsafe(method(isEqualToDateInterval:))]
        #[unsafe(method_family = none)]
        pub fn isEqualToDateInterval(&self, date_interval: &NSDateInterval) -> bool;

        #[unsafe(method(intersectsDateInterval:))]
        #[unsafe(method_family = none)]
        pub fn intersectsDateInterval(&self, date_interval: &NSDateInterval) -> bool;

        #[unsafe(method(intersectionWithDateInterval:))]
        #[unsafe(method_family = none)]
        pub fn intersectionWithDateInterval(
            &self,
            date_interval: &NSDateInterval,
        ) -> Option<Retained<NSDateInterval>>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(containsDate:))]
        #[unsafe(method_family = none)]
        pub fn containsDate(&self, date: &NSDate) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSDateInterval {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSDateInterval {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
