//! 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/nsmassformatterunit?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMassFormatterUnit(pub NSInteger);
impl NSMassFormatterUnit {
    #[doc(alias = "NSMassFormatterUnitGram")]
    pub const Gram: Self = Self(11);
    #[doc(alias = "NSMassFormatterUnitKilogram")]
    pub const Kilogram: Self = Self(14);
    #[doc(alias = "NSMassFormatterUnitOunce")]
    pub const Ounce: Self = Self((6 << 8) + 1);
    #[doc(alias = "NSMassFormatterUnitPound")]
    pub const Pound: Self = Self((6 << 8) + 2);
    #[doc(alias = "NSMassFormatterUnitStone")]
    pub const Stone: Self = Self((6 << 8) + 3);
}

unsafe impl Encode for NSMassFormatterUnit {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

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

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

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

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

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

#[cfg(feature = "NSFormatter")]
impl NSMassFormatter {
    extern_methods!(
        #[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>);

        #[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);

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

        /// Setter for [`isForPersonMassUse`][Self::isForPersonMassUse].
        #[unsafe(method(setForPersonMassUse:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setForPersonMassUse(&self, for_person_mass_use: bool);

        #[cfg(feature = "NSString")]
        #[unsafe(method(stringFromValue:unit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stringFromValue_unit(
            &self,
            value: c_double,
            unit: NSMassFormatterUnit,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(stringFromKilograms:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stringFromKilograms(
            &self,
            number_in_kilograms: c_double,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(unitStringFromValue:unit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn unitStringFromValue_unit(
            &self,
            value: c_double,
            unit: NSMassFormatterUnit,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(unitStringFromKilograms:usedUnit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn unitStringFromKilograms_usedUnit(
            &self,
            number_in_kilograms: c_double,
            unitp: *mut NSMassFormatterUnit,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(getObjectValue:forString:errorDescription:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getObjectValue_forString_errorDescription(
            &self,
            obj: Option<&mut Option<Retained<AnyObject>>>,
            string: &NSString,
            error: Option<&mut Option<Retained<NSString>>>,
        ) -> bool;
    );
}

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