//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdateintervalformatterstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateIntervalFormatterStyle(pub NSUInteger);
impl NSDateIntervalFormatterStyle {
    #[doc(alias = "NSDateIntervalFormatterNoStyle")]
    pub const NoStyle: Self = Self(0);
    #[doc(alias = "NSDateIntervalFormatterShortStyle")]
    pub const ShortStyle: Self = Self(1);
    #[doc(alias = "NSDateIntervalFormatterMediumStyle")]
    pub const MediumStyle: Self = Self(2);
    #[doc(alias = "NSDateIntervalFormatterLongStyle")]
    pub const LongStyle: Self = Self(3);
    #[doc(alias = "NSDateIntervalFormatterFullStyle")]
    pub const FullStyle: Self = Self(4);
}

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

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

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

#[cfg(feature = "NSFormatter")]
unsafe impl Send for NSDateIntervalFormatter {}

#[cfg(feature = "NSFormatter")]
unsafe impl Sync for NSDateIntervalFormatter {}

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
extern_conformance!(
    unsafe impl NSCoding for NSDateIntervalFormatter {}
);

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
extern_conformance!(
    unsafe impl NSCopying for NSDateIntervalFormatter {}
);

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

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

#[cfg(feature = "NSFormatter")]
impl NSDateIntervalFormatter {
    extern_methods!(
        #[cfg(feature = "NSLocale")]
        #[unsafe(method(locale))]
        #[unsafe(method_family = none)]
        pub fn locale(&self) -> Retained<NSLocale>;

        #[cfg(feature = "NSLocale")]
        /// Setter for [`locale`][Self::locale].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setLocale:))]
        #[unsafe(method_family = none)]
        pub fn setLocale(&self, locale: Option<&NSLocale>);

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

        #[cfg(feature = "NSCalendar")]
        /// Setter for [`calendar`][Self::calendar].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setCalendar:))]
        #[unsafe(method_family = none)]
        pub fn setCalendar(&self, calendar: Option<&NSCalendar>);

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

        #[cfg(feature = "NSTimeZone")]
        /// Setter for [`timeZone`][Self::timeZone].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setTimeZone:))]
        #[unsafe(method_family = none)]
        pub fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`dateTemplate`][Self::dateTemplate].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setDateTemplate:))]
        #[unsafe(method_family = none)]
        pub fn setDateTemplate(&self, date_template: Option<&NSString>);

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

        /// Setter for [`dateStyle`][Self::dateStyle].
        #[unsafe(method(setDateStyle:))]
        #[unsafe(method_family = none)]
        pub fn setDateStyle(&self, date_style: NSDateIntervalFormatterStyle);

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

        /// Setter for [`timeStyle`][Self::timeStyle].
        #[unsafe(method(setTimeStyle:))]
        #[unsafe(method_family = none)]
        pub fn setTimeStyle(&self, time_style: NSDateIntervalFormatterStyle);

        #[cfg(all(feature = "NSDate", feature = "NSString"))]
        #[unsafe(method(stringFromDate:toDate:))]
        #[unsafe(method_family = none)]
        pub fn stringFromDate_toDate(
            &self,
            from_date: &NSDate,
            to_date: &NSDate,
        ) -> Retained<NSString>;

        #[cfg(all(feature = "NSDateInterval", feature = "NSString"))]
        #[unsafe(method(stringFromDateInterval:))]
        #[unsafe(method_family = none)]
        pub fn stringFromDateInterval(
            &self,
            date_interval: &NSDateInterval,
        ) -> Option<Retained<NSString>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSFormatter")]
impl NSDateIntervalFormatter {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

#[cfg(feature = "NSFormatter")]
impl DefaultRetained for NSDateIntervalFormatter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
