//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscomparisonpredicateoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSComparisonPredicateOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSComparisonPredicateOptions: NSUInteger {
        #[doc(alias = "NSCaseInsensitivePredicateOption")]
        const CaseInsensitivePredicateOption = 0x01;
        #[doc(alias = "NSDiacriticInsensitivePredicateOption")]
        const DiacriticInsensitivePredicateOption = 0x02;
        #[doc(alias = "NSNormalizedPredicateOption")]
        const NormalizedPredicateOption = 0x04;
    }
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscomparisonpredicatemodifier?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSComparisonPredicateModifier(pub NSUInteger);
impl NSComparisonPredicateModifier {
    #[doc(alias = "NSDirectPredicateModifier")]
    pub const DirectPredicateModifier: Self = Self(0);
    #[doc(alias = "NSAllPredicateModifier")]
    pub const AllPredicateModifier: Self = Self(1);
    #[doc(alias = "NSAnyPredicateModifier")]
    pub const AnyPredicateModifier: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspredicateoperatortype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPredicateOperatorType(pub NSUInteger);
impl NSPredicateOperatorType {
    #[doc(alias = "NSLessThanPredicateOperatorType")]
    pub const LessThanPredicateOperatorType: Self = Self(0);
    #[doc(alias = "NSLessThanOrEqualToPredicateOperatorType")]
    pub const LessThanOrEqualToPredicateOperatorType: Self = Self(1);
    #[doc(alias = "NSGreaterThanPredicateOperatorType")]
    pub const GreaterThanPredicateOperatorType: Self = Self(2);
    #[doc(alias = "NSGreaterThanOrEqualToPredicateOperatorType")]
    pub const GreaterThanOrEqualToPredicateOperatorType: Self = Self(3);
    #[doc(alias = "NSEqualToPredicateOperatorType")]
    pub const EqualToPredicateOperatorType: Self = Self(4);
    #[doc(alias = "NSNotEqualToPredicateOperatorType")]
    pub const NotEqualToPredicateOperatorType: Self = Self(5);
    #[doc(alias = "NSMatchesPredicateOperatorType")]
    pub const MatchesPredicateOperatorType: Self = Self(6);
    #[doc(alias = "NSLikePredicateOperatorType")]
    pub const LikePredicateOperatorType: Self = Self(7);
    #[doc(alias = "NSBeginsWithPredicateOperatorType")]
    pub const BeginsWithPredicateOperatorType: Self = Self(8);
    #[doc(alias = "NSEndsWithPredicateOperatorType")]
    pub const EndsWithPredicateOperatorType: Self = Self(9);
    #[doc(alias = "NSInPredicateOperatorType")]
    pub const InPredicateOperatorType: Self = Self(10);
    #[doc(alias = "NSCustomSelectorPredicateOperatorType")]
    pub const CustomSelectorPredicateOperatorType: Self = Self(11);
    #[doc(alias = "NSContainsPredicateOperatorType")]
    pub const ContainsPredicateOperatorType: Self = Self(99);
    #[doc(alias = "NSBetweenPredicateOperatorType")]
    pub const BetweenPredicateOperatorType: Self = Self(100);
}

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

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

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

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

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

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

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

#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
extern_conformance!(
    unsafe impl NSSecureCoding for NSComparisonPredicate {}
);

#[cfg(feature = "NSPredicate")]
impl NSComparisonPredicate {
    extern_methods!(
        #[cfg(feature = "NSExpression")]
        #[unsafe(method(predicateWithLeftExpression:rightExpression:modifier:type:options:))]
        #[unsafe(method_family = none)]
        pub fn predicateWithLeftExpression_rightExpression_modifier_type_options(
            lhs: &NSExpression,
            rhs: &NSExpression,
            modifier: NSComparisonPredicateModifier,
            r#type: NSPredicateOperatorType,
            options: NSComparisonPredicateOptions,
        ) -> Retained<NSComparisonPredicate>;

        #[cfg(feature = "NSExpression")]
        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[unsafe(method(predicateWithLeftExpression:rightExpression:customSelector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn predicateWithLeftExpression_rightExpression_customSelector(
            lhs: &NSExpression,
            rhs: &NSExpression,
            selector: Sel,
        ) -> Retained<NSComparisonPredicate>;

        #[cfg(feature = "NSExpression")]
        #[unsafe(method(initWithLeftExpression:rightExpression:modifier:type:options:))]
        #[unsafe(method_family = init)]
        pub fn initWithLeftExpression_rightExpression_modifier_type_options(
            this: Allocated<Self>,
            lhs: &NSExpression,
            rhs: &NSExpression,
            modifier: NSComparisonPredicateModifier,
            r#type: NSPredicateOperatorType,
            options: NSComparisonPredicateOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSExpression")]
        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[unsafe(method(initWithLeftExpression:rightExpression:customSelector:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithLeftExpression_rightExpression_customSelector(
            this: Allocated<Self>,
            lhs: &NSExpression,
            rhs: &NSExpression,
            selector: Sel,
        ) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

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

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

        #[cfg(feature = "NSExpression")]
        #[unsafe(method(leftExpression))]
        #[unsafe(method_family = none)]
        pub fn leftExpression(&self) -> Retained<NSExpression>;

        #[cfg(feature = "NSExpression")]
        #[unsafe(method(rightExpression))]
        #[unsafe(method_family = none)]
        pub fn rightExpression(&self) -> Retained<NSExpression>;

        #[unsafe(method(customSelector))]
        #[unsafe(method_family = none)]
        pub fn customSelector(&self) -> Option<Sel>;

        #[unsafe(method(options))]
        #[unsafe(method_family = none)]
        pub fn options(&self) -> NSComparisonPredicateOptions;
    );
}

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

#[cfg(feature = "NSPredicate")]
impl DefaultRetained for NSComparisonPredicate {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
