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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmeasurement?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMeasurement<UnitType: ?Sized = AnyObject>;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl<UnitType: ?Sized + NSCoding> NSCoding for NSMeasurement<UnitType> {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl<UnitType: ?Sized> NSCopying for NSMeasurement<UnitType> {}
);

#[cfg(feature = "NSObject")]
unsafe impl<UnitType: ?Sized + Message> CopyingHelper for NSMeasurement<UnitType> {
    type Result = Self;
}

extern_conformance!(
    unsafe impl<UnitType: ?Sized> NSObjectProtocol for NSMeasurement<UnitType> {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl<UnitType: ?Sized + NSSecureCoding> NSSecureCoding for NSMeasurement<UnitType> {}
);

impl<UnitType: Message> NSMeasurement<UnitType> {
    extern_methods!(
        #[unsafe(method(unit))]
        #[unsafe(method_family = none)]
        pub unsafe fn unit(&self) -> Retained<UnitType>;

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

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

        #[unsafe(method(initWithDoubleValue:unit:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDoubleValue_unit(
            this: Allocated<Self>,
            double_value: c_double,
            unit: &UnitType,
        ) -> Retained<Self>;

        #[cfg(feature = "NSUnit")]
        #[unsafe(method(canBeConvertedToUnit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn canBeConvertedToUnit(&self, unit: &NSUnit) -> bool;

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

        #[unsafe(method(measurementByAddingMeasurement:))]
        #[unsafe(method_family = none)]
        pub unsafe fn measurementByAddingMeasurement(
            &self,
            measurement: &NSMeasurement<UnitType>,
        ) -> Retained<NSMeasurement<UnitType>>;

        #[unsafe(method(measurementBySubtractingMeasurement:))]
        #[unsafe(method_family = none)]
        pub unsafe fn measurementBySubtractingMeasurement(
            &self,
            measurement: &NSMeasurement<UnitType>,
        ) -> Retained<NSMeasurement<UnitType>>;
    );
}

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