//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
use objc2_core_image::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorprominence?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIColorProminence(pub NSInteger);
impl UIColorProminence {
    #[doc(alias = "UIColorProminencePrimary")]
    pub const Primary: Self = Self(0);
    #[doc(alias = "UIColorProminenceSecondary")]
    pub const Secondary: Self = Self(1);
    #[doc(alias = "UIColorProminenceTertiary")]
    pub const Tertiary: Self = Self(2);
    #[doc(alias = "UIColorProminenceQuaternary")]
    pub const Quaternary: Self = Self(3);
}

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

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

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

unsafe impl Send for UIColor {}

unsafe impl Sync for UIColor {}

extern_conformance!(
    unsafe impl NSCoding for UIColor {}
);

extern_conformance!(
    unsafe impl NSCopying for UIColor {}
);

unsafe impl CopyingHelper for UIColor {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for UIColor {}
);

impl UIColor {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithWhite:alpha:))]
        #[unsafe(method_family = none)]
        pub fn colorWithWhite_alpha(white: CGFloat, alpha: CGFloat) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithHue:saturation:brightness:alpha:))]
        #[unsafe(method_family = none)]
        pub fn colorWithHue_saturation_brightness_alpha(
            hue: CGFloat,
            saturation: CGFloat,
            brightness: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithRed:green:blue:alpha:))]
        #[unsafe(method_family = none)]
        pub fn colorWithRed_green_blue_alpha(
            red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithDisplayP3Red:green:blue:alpha:))]
        #[unsafe(method_family = none)]
        pub fn colorWithDisplayP3Red_green_blue_alpha(
            display_p3_red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(colorWithCGColor:))]
        #[unsafe(method_family = none)]
        pub fn colorWithCGColor(cg_color: &CGColor) -> Retained<UIColor>;

        #[cfg(feature = "UIImage")]
        #[unsafe(method(colorWithPatternImage:))]
        #[unsafe(method_family = none)]
        pub fn colorWithPatternImage(image: &UIImage) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-image")]
        #[cfg(not(target_os = "watchos"))]
        #[unsafe(method(colorWithCIColor:))]
        #[unsafe(method_family = none)]
        pub fn colorWithCIColor(ci_color: &CIColor) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithWhite:alpha:))]
        #[unsafe(method_family = init)]
        pub fn initWithWhite_alpha(
            this: Allocated<Self>,
            white: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithHue:saturation:brightness:alpha:))]
        #[unsafe(method_family = init)]
        pub fn initWithHue_saturation_brightness_alpha(
            this: Allocated<Self>,
            hue: CGFloat,
            saturation: CGFloat,
            brightness: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithRed:green:blue:alpha:))]
        #[unsafe(method_family = init)]
        pub fn initWithRed_green_blue_alpha(
            this: Allocated<Self>,
            red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithDisplayP3Red:green:blue:alpha:))]
        #[unsafe(method_family = init)]
        pub fn initWithDisplayP3Red_green_blue_alpha(
            this: Allocated<Self>,
            display_p3_red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(initWithCGColor:))]
        #[unsafe(method_family = init)]
        pub fn initWithCGColor(this: Allocated<Self>, cg_color: &CGColor) -> Retained<UIColor>;

        #[cfg(feature = "UIImage")]
        #[unsafe(method(initWithPatternImage:))]
        #[unsafe(method_family = init)]
        pub fn initWithPatternImage(this: Allocated<Self>, image: &UIImage) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-image")]
        #[cfg(not(target_os = "watchos"))]
        #[unsafe(method(initWithCIColor:))]
        #[unsafe(method_family = init)]
        pub fn initWithCIColor(this: Allocated<Self>, ci_color: &CIColor) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Generates an HDR color by applying an exposure to the SDR color defined by the red, green, and blue components. The `red`, `green`, and `blue` components have a nominal range of [0..1], `exposure` is a value >= 0. To produce an HDR color, we process the given color in a linear color space, multiplying component values by `2^exposure`. The produced color will have a `contentHeadroom` equal to the linearized exposure value. Each whole value of exposure produces a color that is twice as bright.
        #[unsafe(method(initWithRed:green:blue:alpha:exposure:))]
        #[unsafe(method_family = init)]
        pub fn initWithRed_green_blue_alpha_exposure(
            this: Allocated<Self>,
            red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
            exposure: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithRed:green:blue:alpha:exposure:))]
        #[unsafe(method_family = none)]
        pub fn colorWithRed_green_blue_alpha_exposure(
            red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
            exposure: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Generates an HDR color by applying an exposure to the SDR color defined by the red, green, and blue components. The `red`, `green`, and `blue` components have a nominal range of [0..1], `linearExposure` is a value >= 1. To produce an HDR color, we process the given color in a linear color space, multiplying component values by `linearExposure `. The produced color will have a `contentHeadroom` equal to `linearExposure`. Each doubling of `linearExposure` produces a color that is twice as bright.
        #[unsafe(method(initWithRed:green:blue:alpha:linearExposure:))]
        #[unsafe(method_family = init)]
        pub fn initWithRed_green_blue_alpha_linearExposure(
            this: Allocated<Self>,
            red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
            linear_exposure: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithRed:green:blue:alpha:linearExposure:))]
        #[unsafe(method_family = none)]
        pub fn colorWithRed_green_blue_alpha_linearExposure(
            red: CGFloat,
            green: CGFloat,
            blue: CGFloat,
            alpha: CGFloat,
            linear_exposure: CGFloat,
        ) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Reinterpret the color by applying a new `contentHeadroom` without changing the color components. Changing the `contentHeadroom` redefines the color relative to a different peak white, changing its behavior under tone mapping and the result of calling `standardDynamicRangeColor`. The new color will have a `contentHeadroom` >= 1.0.
        #[unsafe(method(colorByApplyingContentHeadroom:))]
        #[unsafe(method_family = none)]
        pub fn colorByApplyingContentHeadroom(
            &self,
            content_headroom: CGFloat,
        ) -> Retained<UIColor>;

        #[unsafe(method(blackColor))]
        #[unsafe(method_family = none)]
        pub fn blackColor() -> Retained<UIColor>;

        #[unsafe(method(darkGrayColor))]
        #[unsafe(method_family = none)]
        pub fn darkGrayColor() -> Retained<UIColor>;

        #[unsafe(method(lightGrayColor))]
        #[unsafe(method_family = none)]
        pub fn lightGrayColor() -> Retained<UIColor>;

        #[unsafe(method(whiteColor))]
        #[unsafe(method_family = none)]
        pub fn whiteColor() -> Retained<UIColor>;

        #[unsafe(method(grayColor))]
        #[unsafe(method_family = none)]
        pub fn grayColor() -> Retained<UIColor>;

        #[unsafe(method(redColor))]
        #[unsafe(method_family = none)]
        pub fn redColor() -> Retained<UIColor>;

        #[unsafe(method(greenColor))]
        #[unsafe(method_family = none)]
        pub fn greenColor() -> Retained<UIColor>;

        #[unsafe(method(blueColor))]
        #[unsafe(method_family = none)]
        pub fn blueColor() -> Retained<UIColor>;

        #[unsafe(method(cyanColor))]
        #[unsafe(method_family = none)]
        pub fn cyanColor() -> Retained<UIColor>;

        #[unsafe(method(yellowColor))]
        #[unsafe(method_family = none)]
        pub fn yellowColor() -> Retained<UIColor>;

        #[unsafe(method(magentaColor))]
        #[unsafe(method_family = none)]
        pub fn magentaColor() -> Retained<UIColor>;

        #[unsafe(method(orangeColor))]
        #[unsafe(method_family = none)]
        pub fn orangeColor() -> Retained<UIColor>;

        #[unsafe(method(purpleColor))]
        #[unsafe(method_family = none)]
        pub fn purpleColor() -> Retained<UIColor>;

        #[unsafe(method(brownColor))]
        #[unsafe(method_family = none)]
        pub fn brownColor() -> Retained<UIColor>;

        #[unsafe(method(clearColor))]
        #[unsafe(method_family = none)]
        pub fn clearColor() -> Retained<UIColor>;

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// - `white` must be a valid pointer or null.
        /// - `alpha` must be a valid pointer or null.
        #[unsafe(method(getWhite:alpha:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getWhite_alpha(&self, white: *mut CGFloat, alpha: *mut CGFloat) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// - `hue` must be a valid pointer or null.
        /// - `saturation` must be a valid pointer or null.
        /// - `brightness` must be a valid pointer or null.
        /// - `alpha` must be a valid pointer or null.
        #[unsafe(method(getHue:saturation:brightness:alpha:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getHue_saturation_brightness_alpha(
            &self,
            hue: *mut CGFloat,
            saturation: *mut CGFloat,
            brightness: *mut CGFloat,
            alpha: *mut CGFloat,
        ) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// - `red` must be a valid pointer or null.
        /// - `green` must be a valid pointer or null.
        /// - `blue` must be a valid pointer or null.
        /// - `alpha` must be a valid pointer or null.
        #[unsafe(method(getRed:green:blue:alpha:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getRed_green_blue_alpha(
            &self,
            red: *mut CGFloat,
            green: *mut CGFloat,
            blue: *mut CGFloat,
            alpha: *mut CGFloat,
        ) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(colorWithAlphaComponent:))]
        #[unsafe(method_family = none)]
        pub fn colorWithAlphaComponent(&self, alpha: CGFloat) -> Retained<UIColor>;

        #[cfg(feature = "objc2-core-graphics")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(CGColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn CGColor(&self) -> Retained<CGColor>;

        #[cfg(feature = "objc2-core-image")]
        #[cfg(not(target_os = "watchos"))]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(CIColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn CIColor(&self) -> Retained<CIColor>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The linear brightness multiplier that was applied when generating this color. Colors created with an exposure by UIColor create CGColors that are tagged with a contentHeadroom value. While CGColors created without a contentHeadroom tag will return 0 from CGColorGetHeadroom, UIColors generated in a similar fashion return a linearExposure of 1.0.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(linearExposure))]
        #[unsafe(method_family = none)]
        pub unsafe fn linearExposure(&self) -> CGFloat;

        /// In some cases it is useful to recover the color that was base SDR color that was exposed to generate the given HDR color. If a color's `linearExposure` is >1, then this will return the base SDR color.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(standardDynamicRangeColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn standardDynamicRangeColor(&self) -> Retained<UIColor>;
    );
}

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

impl DefaultRetained for UIColor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// UINSItemProvider.
impl UIColor {
    extern_methods!();
}

extern_conformance!(
    unsafe impl NSItemProviderReading for UIColor {}
);

extern_conformance!(
    unsafe impl NSItemProviderWriting for UIColor {}
);

mod private_CIColorUIKitAdditions {
    pub trait Sealed {}
}

/// Category "UIKitAdditions" on [`CIColor`].
#[doc(alias = "UIKitAdditions")]
pub unsafe trait CIColorUIKitAdditions:
    ClassType + Sized + private_CIColorUIKitAdditions::Sealed
{
    extern_methods!(
        #[unsafe(method(initWithColor:))]
        #[unsafe(method_family = init)]
        fn initWithColor(this: Allocated<Self>, color: &UIColor) -> Retained<Self>;
    );
}

#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
impl private_CIColorUIKitAdditions::Sealed for CIColor {}
#[cfg(feature = "objc2-core-image")]
#[cfg(not(target_os = "watchos"))]
unsafe impl CIColorUIKitAdditions for CIColor {}

/// UIColorNamedColors.
impl UIColor {
    extern_methods!(
        #[unsafe(method(colorNamed:))]
        #[unsafe(method_family = none)]
        pub fn colorNamed(name: &NSString) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UITraitCollection")]
        #[unsafe(method(colorNamed:inBundle:compatibleWithTraitCollection:))]
        #[unsafe(method_family = none)]
        pub fn colorNamed_inBundle_compatibleWithTraitCollection(
            name: &NSString,
            bundle: Option<&NSBundle>,
            trait_collection: Option<&UITraitCollection>,
        ) -> Option<Retained<UIColor>>;
    );
}

/// DynamicColors.
impl UIColor {
    extern_methods!(
        #[cfg(all(feature = "UITraitCollection", feature = "block2"))]
        /// # Safety
        ///
        /// `dynamic_provider` block's return must be a valid pointer.
        #[unsafe(method(colorWithDynamicProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn colorWithDynamicProvider(
            dynamic_provider: &block2::DynBlock<
                dyn Fn(NonNull<UITraitCollection>) -> NonNull<UIColor>,
            >,
        ) -> Retained<UIColor>;

        #[cfg(all(feature = "UITraitCollection", feature = "block2"))]
        /// # Safety
        ///
        /// `dynamic_provider` block's return must be a valid pointer.
        #[unsafe(method(initWithDynamicProvider:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDynamicProvider(
            this: Allocated<Self>,
            dynamic_provider: &block2::DynBlock<
                dyn Fn(NonNull<UITraitCollection>) -> NonNull<UIColor>,
            >,
        ) -> Retained<UIColor>;

        #[cfg(feature = "UITraitCollection")]
        #[unsafe(method(resolvedColorWithTraitCollection:))]
        #[unsafe(method_family = none)]
        pub fn resolvedColorWithTraitCollection(
            &self,
            trait_collection: &UITraitCollection,
        ) -> Retained<UIColor>;
    );
}

/// ProminenceSupport.
impl UIColor {
    extern_methods!(
        #[unsafe(method(colorWithProminence:))]
        #[unsafe(method_family = none)]
        pub fn colorWithProminence(&self, prominence: UIColorProminence) -> Retained<UIColor>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(prominence))]
        #[unsafe(method_family = none)]
        pub unsafe fn prominence(&self) -> UIColorProminence;
    );
}
