//! 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/nsmeasurementformatterunitoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMeasurementFormatterUnitOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSMeasurementFormatterUnitOptions: NSUInteger {
        #[doc(alias = "NSMeasurementFormatterUnitOptionsProvidedUnit")]
        const ProvidedUnit = 1<<0;
        #[doc(alias = "NSMeasurementFormatterUnitOptionsNaturalScale")]
        const NaturalScale = 1<<1;
        #[doc(alias = "NSMeasurementFormatterUnitOptionsTemperatureWithoutUnit")]
        const TemperatureWithoutUnit = 1<<2;
    }
}

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

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

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

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSMeasurementFormatter {}

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSMeasurementFormatter {}

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

#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSMeasurementFormatter {}

#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSSecureCoding for NSMeasurementFormatter {}

#[cfg(feature = "NSFormatter")]
impl NSMeasurementFormatter {
    extern_methods!(
        #[unsafe(method(unitOptions))]
        #[unsafe(method_family = none)]
        pub unsafe fn unitOptions(&self) -> NSMeasurementFormatterUnitOptions;

        /// Setter for [`unitOptions`][Self::unitOptions].
        #[unsafe(method(setUnitOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUnitOptions(&self, unit_options: NSMeasurementFormatterUnitOptions);

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

        /// Setter for [`unitStyle`][Self::unitStyle].
        #[unsafe(method(setUnitStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);

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

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

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

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

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

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

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