//! 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/nsnospecifiererror?language=objc)
pub const NSNoSpecifierError: NSInteger = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnotoplevelcontainersspecifiererror?language=objc)
pub const NSNoTopLevelContainersSpecifierError: NSInteger = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscontainerspecifiererror?language=objc)
pub const NSContainerSpecifierError: NSInteger = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsunknownkeyspecifiererror?language=objc)
pub const NSUnknownKeySpecifierError: NSInteger = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidindexspecifiererror?language=objc)
pub const NSInvalidIndexSpecifierError: NSInteger = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinternalspecifiererror?language=objc)
pub const NSInternalSpecifierError: NSInteger = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsoperationnotsupportedforkeyspecifiererror?language=objc)
pub const NSOperationNotSupportedForKeySpecifierError: NSInteger = 6;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinsertionposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSInsertionPosition(pub NSUInteger);
impl NSInsertionPosition {
    #[doc(alias = "NSPositionAfter")]
    pub const PositionAfter: Self = Self(0);
    #[doc(alias = "NSPositionBefore")]
    pub const PositionBefore: Self = Self(1);
    #[doc(alias = "NSPositionBeginning")]
    pub const PositionBeginning: Self = Self(2);
    #[doc(alias = "NSPositionEnd")]
    pub const PositionEnd: Self = Self(3);
    #[doc(alias = "NSPositionReplace")]
    pub const PositionReplace: Self = Self(4);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrelativeposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRelativePosition(pub NSUInteger);
impl NSRelativePosition {
    #[doc(alias = "NSRelativeAfter")]
    pub const After: Self = Self(0);
    #[doc(alias = "NSRelativeBefore")]
    pub const Before: Self = Self(1);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nswhosesubelementidentifier?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWhoseSubelementIdentifier(pub NSUInteger);
impl NSWhoseSubelementIdentifier {
    #[doc(alias = "NSIndexSubelement")]
    pub const IndexSubelement: Self = Self(0);
    #[doc(alias = "NSEverySubelement")]
    pub const EverySubelement: Self = Self(1);
    #[doc(alias = "NSMiddleSubelement")]
    pub const MiddleSubelement: Self = Self(2);
    #[doc(alias = "NSRandomSubelement")]
    pub const RandomSubelement: Self = Self(3);
    #[doc(alias = "NSNoSubelement")]
    pub const NoSubelement: Self = Self(4);
}

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

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

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSScriptObjectSpecifier {}
);

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

impl NSScriptObjectSpecifier {
    extern_methods!(
        #[cfg(feature = "NSAppleEventDescriptor")]
        #[unsafe(method(objectSpecifierWithDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn objectSpecifierWithDescriptor(
            descriptor: &NSAppleEventDescriptor,
        ) -> Option<Retained<NSScriptObjectSpecifier>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;

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

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(childSpecifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn childSpecifier(&self) -> Option<Retained<NSScriptObjectSpecifier>>;

        /// Setter for [`childSpecifier`][Self::childSpecifier].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setChildSpecifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setChildSpecifier(&self, child_specifier: Option<&NSScriptObjectSpecifier>);

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

        /// Setter for [`containerSpecifier`][Self::containerSpecifier].
        #[unsafe(method(setContainerSpecifier:))]
        #[unsafe(method_family = none)]
        pub fn setContainerSpecifier(&self, container_specifier: Option<&NSScriptObjectSpecifier>);

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

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

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

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

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

        #[cfg(feature = "NSString")]
        /// Setter for [`key`][Self::key].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setKey:))]
        #[unsafe(method_family = none)]
        pub fn setKey(&self, key: &NSString);

        #[cfg(all(feature = "NSClassDescription", feature = "NSScriptClassDescription"))]
        #[unsafe(method(containerClassDescription))]
        #[unsafe(method_family = none)]
        pub fn containerClassDescription(&self) -> Option<Retained<NSScriptClassDescription>>;

        #[cfg(all(feature = "NSClassDescription", feature = "NSScriptClassDescription"))]
        /// Setter for [`containerClassDescription`][Self::containerClassDescription].
        #[unsafe(method(setContainerClassDescription:))]
        #[unsafe(method_family = none)]
        pub fn setContainerClassDescription(
            &self,
            container_class_description: Option<&NSScriptClassDescription>,
        );

        #[cfg(all(feature = "NSClassDescription", feature = "NSScriptClassDescription"))]
        #[unsafe(method(keyClassDescription))]
        #[unsafe(method_family = none)]
        pub fn keyClassDescription(&self) -> Option<Retained<NSScriptClassDescription>>;

        /// # Safety
        ///
        /// - `container` should be of the correct type.
        /// - `count` must be a valid pointer.
        #[unsafe(method(indicesOfObjectsByEvaluatingWithContainer:count:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indicesOfObjectsByEvaluatingWithContainer_count(
            &self,
            container: &AnyObject,
            count: NonNull<NSInteger>,
        ) -> *mut NSInteger;

        /// # Safety
        ///
        /// `containers` should be of the correct type.
        #[unsafe(method(objectsByEvaluatingWithContainers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectsByEvaluatingWithContainers(
            &self,
            containers: &AnyObject,
        ) -> Option<Retained<AnyObject>>;

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

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

        /// Setter for [`evaluationErrorNumber`][Self::evaluationErrorNumber].
        #[unsafe(method(setEvaluationErrorNumber:))]
        #[unsafe(method_family = none)]
        pub fn setEvaluationErrorNumber(&self, evaluation_error_number: NSInteger);

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

        #[cfg(feature = "NSAppleEventDescriptor")]
        #[unsafe(method(descriptor))]
        #[unsafe(method_family = none)]
        pub fn descriptor(&self) -> Option<Retained<NSAppleEventDescriptor>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSScriptObjectSpecifier {
    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 NSScriptObjectSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

mod private_NSObjectNSScriptObjectSpecifiers {
    pub trait Sealed {}
}

/// Category "NSScriptObjectSpecifiers" on [`NSObject`].
#[doc(alias = "NSScriptObjectSpecifiers")]
pub unsafe trait NSObjectNSScriptObjectSpecifiers:
    ClassType + Sized + private_NSObjectNSScriptObjectSpecifiers::Sealed
{
    extern_methods!(
        #[unsafe(method(objectSpecifier))]
        #[unsafe(method_family = none)]
        fn objectSpecifier(&self) -> Option<Retained<NSScriptObjectSpecifier>>;

        #[cfg(all(feature = "NSArray", feature = "NSValue"))]
        #[unsafe(method(indicesOfObjectsByEvaluatingObjectSpecifier:))]
        #[unsafe(method_family = none)]
        fn indicesOfObjectsByEvaluatingObjectSpecifier(
            &self,
            specifier: &NSScriptObjectSpecifier,
        ) -> Option<Retained<NSArray<NSNumber>>>;
    );
}

impl private_NSObjectNSScriptObjectSpecifiers::Sealed for NSObject {}
unsafe impl NSObjectNSScriptObjectSpecifiers for NSObject {}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSIndexSpecifier {}
);

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

impl NSIndexSpecifier {
    extern_methods!(
        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:index:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key_index(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
            index: NSInteger,
        ) -> Retained<Self>;

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

        /// Setter for [`index`][Self::index].
        #[unsafe(method(setIndex:))]
        #[unsafe(method_family = none)]
        pub fn setIndex(&self, index: NSInteger);
    );
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSIndexSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;

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

/// Methods declared on superclass `NSObject`.
impl NSIndexSpecifier {
    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 NSIndexSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSMiddleSpecifier {}
);

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

impl NSMiddleSpecifier {
    extern_methods!();
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSMiddleSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;

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

/// Methods declared on superclass `NSObject`.
impl NSMiddleSpecifier {
    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 NSMiddleSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSNameSpecifier {}
);

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

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

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:name:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key_name(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
            name: &NSString,
        ) -> Retained<Self>;

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

        #[cfg(feature = "NSString")]
        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub fn setName(&self, name: &NSString);
    );
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSNameSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSNameSpecifier {
    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 NSNameSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

impl NSPositionalSpecifier {
    extern_methods!(
        #[unsafe(method(initWithPosition:objectSpecifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithPosition_objectSpecifier(
            this: Allocated<Self>,
            position: NSInsertionPosition,
            specifier: &NSScriptObjectSpecifier,
        ) -> Retained<Self>;

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

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

        #[cfg(all(feature = "NSClassDescription", feature = "NSScriptClassDescription"))]
        #[unsafe(method(setInsertionClassDescription:))]
        #[unsafe(method_family = none)]
        pub fn setInsertionClassDescription(&self, class_description: &NSScriptClassDescription);

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

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

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

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

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

/// Methods declared on superclass `NSObject`.
impl NSPositionalSpecifier {
    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 NSPositionalSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSPropertySpecifier {}
);

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

impl NSPropertySpecifier {
    extern_methods!();
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSPropertySpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;

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

/// Methods declared on superclass `NSObject`.
impl NSPropertySpecifier {
    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 NSPropertySpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSRandomSpecifier {}
);

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

impl NSRandomSpecifier {
    extern_methods!();
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSRandomSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;

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

/// Methods declared on superclass `NSObject`.
impl NSRandomSpecifier {
    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 NSRandomSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSRangeSpecifier {}
);

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

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

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:startSpecifier:endSpecifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key_startSpecifier_endSpecifier(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
            start_spec: Option<&NSScriptObjectSpecifier>,
            end_spec: Option<&NSScriptObjectSpecifier>,
        ) -> Retained<Self>;

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

        /// Setter for [`startSpecifier`][Self::startSpecifier].
        #[unsafe(method(setStartSpecifier:))]
        #[unsafe(method_family = none)]
        pub fn setStartSpecifier(&self, start_specifier: Option<&NSScriptObjectSpecifier>);

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

        /// Setter for [`endSpecifier`][Self::endSpecifier].
        #[unsafe(method(setEndSpecifier:))]
        #[unsafe(method_family = none)]
        pub fn setEndSpecifier(&self, end_specifier: Option<&NSScriptObjectSpecifier>);
    );
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSRangeSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSRangeSpecifier {
    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 NSRangeSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSRelativeSpecifier {}
);

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

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

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:relativePosition:baseSpecifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key_relativePosition_baseSpecifier(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
            rel_pos: NSRelativePosition,
            base_specifier: Option<&NSScriptObjectSpecifier>,
        ) -> Retained<Self>;

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

        /// Setter for [`relativePosition`][Self::relativePosition].
        #[unsafe(method(setRelativePosition:))]
        #[unsafe(method_family = none)]
        pub fn setRelativePosition(&self, relative_position: NSRelativePosition);

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

        /// Setter for [`baseSpecifier`][Self::baseSpecifier].
        #[unsafe(method(setBaseSpecifier:))]
        #[unsafe(method_family = none)]
        pub fn setBaseSpecifier(&self, base_specifier: Option<&NSScriptObjectSpecifier>);
    );
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSRelativeSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSRelativeSpecifier {
    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 NSRelativeSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSUniqueIDSpecifier {}
);

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

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

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        /// # Safety
        ///
        /// `unique_id` should be of the correct type.
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:uniqueID:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContainerClassDescription_containerSpecifier_key_uniqueID(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
            unique_id: &AnyObject,
        ) -> Retained<Self>;

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

        /// Setter for [`uniqueID`][Self::uniqueID].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `unique_id` should be of the correct type.
        #[unsafe(method(setUniqueID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUniqueID(&self, unique_id: &AnyObject);
    );
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSUniqueIDSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUniqueIDSpecifier {
    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 NSUniqueIDSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSWhoseSpecifier {}
);

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

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

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSScriptWhoseTests",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:test:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key_test(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
            test: &NSScriptWhoseTest,
        ) -> Retained<Self>;

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

        #[cfg(feature = "NSScriptWhoseTests")]
        /// Setter for [`test`][Self::test].
        #[unsafe(method(setTest:))]
        #[unsafe(method_family = none)]
        pub fn setTest(&self, test: &NSScriptWhoseTest);

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

        /// Setter for [`startSubelementIdentifier`][Self::startSubelementIdentifier].
        #[unsafe(method(setStartSubelementIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setStartSubelementIdentifier(
            &self,
            start_subelement_identifier: NSWhoseSubelementIdentifier,
        );

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

        /// Setter for [`startSubelementIndex`][Self::startSubelementIndex].
        #[unsafe(method(setStartSubelementIndex:))]
        #[unsafe(method_family = none)]
        pub fn setStartSubelementIndex(&self, start_subelement_index: NSInteger);

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

        /// Setter for [`endSubelementIdentifier`][Self::endSubelementIdentifier].
        #[unsafe(method(setEndSubelementIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setEndSubelementIdentifier(
            &self,
            end_subelement_identifier: NSWhoseSubelementIdentifier,
        );

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

        /// Setter for [`endSubelementIndex`][Self::endSubelementIndex].
        #[unsafe(method(setEndSubelementIndex:))]
        #[unsafe(method_family = none)]
        pub fn setEndSubelementIndex(&self, end_subelement_index: NSInteger);
    );
}

/// Methods declared on superclass `NSScriptObjectSpecifier`.
impl NSWhoseSpecifier {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithContainerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerSpecifier_key(
            this: Allocated<Self>,
            container: &NSScriptObjectSpecifier,
            property: &NSString,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSClassDescription",
            feature = "NSScriptClassDescription",
            feature = "NSString"
        ))]
        #[unsafe(method(initWithContainerClassDescription:containerSpecifier:key:))]
        #[unsafe(method_family = init)]
        pub fn initWithContainerClassDescription_containerSpecifier_key(
            this: Allocated<Self>,
            class_desc: &NSScriptClassDescription,
            container: Option<&NSScriptObjectSpecifier>,
            property: &NSString,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSWhoseSpecifier {
    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 NSWhoseSpecifier {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
