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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidevicebatterystate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIDeviceBatteryState(pub NSInteger);
impl UIDeviceBatteryState {
    #[doc(alias = "UIDeviceBatteryStateUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "UIDeviceBatteryStateUnplugged")]
    pub const Unplugged: Self = Self(1);
    #[doc(alias = "UIDeviceBatteryStateCharging")]
    pub const Charging: Self = Self(2);
    #[doc(alias = "UIDeviceBatteryStateFull")]
    pub const Full: Self = Self(3);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiuserinterfaceidiom?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIUserInterfaceIdiom(pub NSInteger);
impl UIUserInterfaceIdiom {
    #[doc(alias = "UIUserInterfaceIdiomUnspecified")]
    pub const Unspecified: Self = Self(-1);
    #[doc(alias = "UIUserInterfaceIdiomPhone")]
    pub const Phone: Self = Self(0);
    #[doc(alias = "UIUserInterfaceIdiomPad")]
    pub const Pad: Self = Self(1);
    #[doc(alias = "UIUserInterfaceIdiomTV")]
    pub const TV: Self = Self(2);
    #[doc(alias = "UIUserInterfaceIdiomCarPlay")]
    pub const CarPlay: Self = Self(3);
    #[doc(alias = "UIUserInterfaceIdiomMac")]
    pub const Mac: Self = Self(5);
    #[doc(alias = "UIUserInterfaceIdiomVision")]
    pub const Vision: Self = Self(6);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidevice?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIDevice;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIDevice {}
);

impl UIDevice {
    extern_methods!(
        #[unsafe(method(currentDevice))]
        #[unsafe(method_family = none)]
        pub fn currentDevice(mtm: MainThreadMarker) -> Retained<UIDevice>;

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

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

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

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

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

        #[cfg(feature = "UIOrientation")]
        #[unsafe(method(orientation))]
        #[unsafe(method_family = none)]
        pub fn orientation(&self) -> UIDeviceOrientation;

        #[unsafe(method(identifierForVendor))]
        #[unsafe(method_family = none)]
        pub fn identifierForVendor(&self) -> Option<Retained<NSUUID>>;

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

        #[unsafe(method(beginGeneratingDeviceOrientationNotifications))]
        #[unsafe(method_family = none)]
        pub fn beginGeneratingDeviceOrientationNotifications(&self);

        #[unsafe(method(endGeneratingDeviceOrientationNotifications))]
        #[unsafe(method_family = none)]
        pub fn endGeneratingDeviceOrientationNotifications(&self);

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

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

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

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

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

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

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

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

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

        #[unsafe(method(playInputClick))]
        #[unsafe(method_family = none)]
        pub fn playInputClick(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIDevice {
    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(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiinputviewaudiofeedback?language=objc)
    pub unsafe trait UIInputViewAudioFeedback: NSObjectProtocol + MainThreadOnly {
        #[optional]
        #[unsafe(method(enableInputClicksWhenVisible))]
        #[unsafe(method_family = none)]
        fn enableInputClicksWhenVisible(&self) -> bool;
    }
);

impl UIUserInterfaceIdiom {
    // TODO: pub fn UI_USER_INTERFACE_IDIOM() -> UIUserInterfaceIdiom;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uideviceorientationdidchangenotification?language=objc)
    pub static UIDeviceOrientationDidChangeNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidevicebatterystatedidchangenotification?language=objc)
    pub static UIDeviceBatteryStateDidChangeNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidevicebatteryleveldidchangenotification?language=objc)
    pub static UIDeviceBatteryLevelDidChangeNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uideviceproximitystatedidchangenotification?language=objc)
    pub static UIDeviceProximityStateDidChangeNotification: &'static NSNotificationName;
}
