//! 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/nsbytecountformatterunits?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSByteCountFormatterUnits(pub NSUInteger);
bitflags::bitflags! {
    impl NSByteCountFormatterUnits: NSUInteger {
        #[doc(alias = "NSByteCountFormatterUseDefault")]
        const UseDefault = 0;
        #[doc(alias = "NSByteCountFormatterUseBytes")]
        const UseBytes = 1<<0;
        #[doc(alias = "NSByteCountFormatterUseKB")]
        const UseKB = 1<<1;
        #[doc(alias = "NSByteCountFormatterUseMB")]
        const UseMB = 1<<2;
        #[doc(alias = "NSByteCountFormatterUseGB")]
        const UseGB = 1<<3;
        #[doc(alias = "NSByteCountFormatterUseTB")]
        const UseTB = 1<<4;
        #[doc(alias = "NSByteCountFormatterUsePB")]
        const UsePB = 1<<5;
        #[doc(alias = "NSByteCountFormatterUseEB")]
        const UseEB = 1<<6;
        #[doc(alias = "NSByteCountFormatterUseZB")]
        const UseZB = 1<<7;
        #[doc(alias = "NSByteCountFormatterUseYBOrHigher")]
        const UseYBOrHigher = 0x0FF<<8;
        #[doc(alias = "NSByteCountFormatterUseAll")]
        const UseAll = 0x0FFFF;
    }
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbytecountformattercountstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSByteCountFormatterCountStyle(pub NSInteger);
impl NSByteCountFormatterCountStyle {
    #[doc(alias = "NSByteCountFormatterCountStyleFile")]
    pub const File: Self = Self(0);
    #[doc(alias = "NSByteCountFormatterCountStyleMemory")]
    pub const Memory: Self = Self(1);
    #[doc(alias = "NSByteCountFormatterCountStyleDecimal")]
    pub const Decimal: Self = Self(2);
    #[doc(alias = "NSByteCountFormatterCountStyleBinary")]
    pub const Binary: Self = Self(3);
}

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

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

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

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

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

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

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

#[cfg(feature = "NSFormatter")]
impl NSByteCountFormatter {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(stringFromByteCount:countStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stringFromByteCount_countStyle(
            byte_count: c_longlong,
            count_style: NSByteCountFormatterCountStyle,
        ) -> Retained<NSString>;

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

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

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

        #[cfg(feature = "NSString")]
        #[unsafe(method(stringForObjectValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stringForObjectValue(
            &self,
            obj: Option<&AnyObject>,
        ) -> Option<Retained<NSString>>;

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

        /// Setter for [`allowedUnits`][Self::allowedUnits].
        #[unsafe(method(setAllowedUnits:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowedUnits(&self, allowed_units: NSByteCountFormatterUnits);

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

        /// Setter for [`countStyle`][Self::countStyle].
        #[unsafe(method(setCountStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCountStyle(&self, count_style: NSByteCountFormatterCountStyle);

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

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

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

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

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

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

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

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

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

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

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

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

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

        /// Setter for [`formattingContext`][Self::formattingContext].
        #[unsafe(method(setFormattingContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFormattingContext(&self, formatting_context: NSFormattingContext);
    );
}

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