//! 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/coredata/nsattributetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAttributeType(pub NSUInteger);
impl NSAttributeType {
    #[doc(alias = "NSUndefinedAttributeType")]
    pub const UndefinedAttributeType: Self = Self(0);
    #[doc(alias = "NSInteger16AttributeType")]
    pub const Integer16AttributeType: Self = Self(100);
    #[doc(alias = "NSInteger32AttributeType")]
    pub const Integer32AttributeType: Self = Self(200);
    #[doc(alias = "NSInteger64AttributeType")]
    pub const Integer64AttributeType: Self = Self(300);
    #[doc(alias = "NSDecimalAttributeType")]
    pub const DecimalAttributeType: Self = Self(400);
    #[doc(alias = "NSDoubleAttributeType")]
    pub const DoubleAttributeType: Self = Self(500);
    #[doc(alias = "NSFloatAttributeType")]
    pub const FloatAttributeType: Self = Self(600);
    #[doc(alias = "NSStringAttributeType")]
    pub const StringAttributeType: Self = Self(700);
    #[doc(alias = "NSBooleanAttributeType")]
    pub const BooleanAttributeType: Self = Self(800);
    #[doc(alias = "NSDateAttributeType")]
    pub const DateAttributeType: Self = Self(900);
    #[doc(alias = "NSBinaryDataAttributeType")]
    pub const BinaryDataAttributeType: Self = Self(1000);
    #[doc(alias = "NSUUIDAttributeType")]
    pub const UUIDAttributeType: Self = Self(1100);
    #[doc(alias = "NSURIAttributeType")]
    pub const URIAttributeType: Self = Self(1200);
    #[doc(alias = "NSTransformableAttributeType")]
    pub const TransformableAttributeType: Self = Self(1800);
    #[doc(alias = "NSObjectIDAttributeType")]
    pub const ObjectIDAttributeType: Self = Self(2000);
    #[doc(alias = "NSCompositeAttributeType")]
    pub const CompositeAttributeType: Self = Self(2100);
}

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

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

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

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

#[cfg(feature = "NSPropertyDescription")]
extern_conformance!(
    unsafe impl NSCopying for NSAttributeDescription {}
);

#[cfg(feature = "NSPropertyDescription")]
unsafe impl CopyingHelper for NSAttributeDescription {
    type Result = Self;
}

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

#[cfg(feature = "NSPropertyDescription")]
impl NSAttributeDescription {
    extern_methods!(
        #[unsafe(method(attributeType))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributeType(&self) -> NSAttributeType;

        /// Setter for [`attributeType`][Self::attributeType].
        #[unsafe(method(setAttributeType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAttributeType(&self, attribute_type: NSAttributeType);

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

        /// Setter for [`attributeValueClassName`][Self::attributeValueClassName].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributeValueClassName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAttributeValueClassName(
            &self,
            attribute_value_class_name: Option<&NSString>,
        );

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

        /// Setter for [`defaultValue`][Self::defaultValue].
        ///
        /// # Safety
        ///
        /// `default_value` should be of the correct type.
        #[unsafe(method(setDefaultValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDefaultValue(&self, default_value: Option<&AnyObject>);

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

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

        /// Setter for [`valueTransformerName`][Self::valueTransformerName].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setValueTransformerName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValueTransformerName(&self, value_transformer_name: Option<&NSString>);

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

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

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

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

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

        /// Setter for [`allowsCloudEncryption`][Self::allowsCloudEncryption].
        #[unsafe(method(setAllowsCloudEncryption:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAllowsCloudEncryption(&self, allows_cloud_encryption: bool);
    );
}

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