//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;

use crate::*;

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

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

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

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

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

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

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "objc2-core-location")]
        #[unsafe(method(initWithKey:relativeLocation:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKey_relativeLocation(
            this: Allocated<Self>,
            key: &NSString,
            relative_location: &CLLocation,
        ) -> Retained<Self>;

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

        #[cfg(feature = "objc2-core-location")]
        #[unsafe(method(relativeLocation))]
        #[unsafe(method_family = none)]
        pub unsafe fn relativeLocation(&self) -> Retained<CLLocation>;
    );
}

/// Methods declared on superclass `NSSortDescriptor`.
impl CKLocationSortDescriptor {
    extern_methods!(
        #[unsafe(method(sortDescriptorWithKey:ascending:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortDescriptorWithKey_ascending(
            key: Option<&NSString>,
            ascending: bool,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[unsafe(method(sortDescriptorWithKey:ascending:selector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortDescriptorWithKey_ascending_selector(
            key: Option<&NSString>,
            ascending: bool,
            selector: Option<Sel>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithKey:ascending:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKey_ascending(
            this: Allocated<Self>,
            key: Option<&NSString>,
            ascending: bool,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[unsafe(method(initWithKey:ascending:selector:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKey_ascending_selector(
            this: Allocated<Self>,
            key: Option<&NSString>,
            ascending: bool,
            selector: Option<Sel>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `cmptr` must be a valid pointer.
        #[unsafe(method(sortDescriptorWithKey:ascending:comparator:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortDescriptorWithKey_ascending_comparator(
            key: Option<&NSString>,
            ascending: bool,
            cmptr: NSComparator,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `cmptr` must be a valid pointer.
        #[unsafe(method(initWithKey:ascending:comparator:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKey_ascending_comparator(
            this: Allocated<Self>,
            key: Option<&NSString>,
            ascending: bool,
            cmptr: NSComparator,
        ) -> Retained<Self>;
    );
}
