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

use crate::*;

#[cfg(all(
    feature = "CFArray",
    feature = "CFBase",
    feature = "CFData",
    feature = "CFDictionary",
    feature = "CFURL"
))]
#[deprecated = "For resource data, use the CFReadStream API. For file resource properties, use CFURLCopyResourcePropertiesForKeys."]
#[inline]
pub unsafe extern "C-unwind" fn CFURLCreateDataAndPropertiesFromResource(
    alloc: Option<&CFAllocator>,
    url: Option<&CFURL>,
    resource_data: *mut *const CFData,
    properties: *mut *const CFDictionary,
    desired_properties: Option<&CFArray>,
    error_code: *mut i32,
) -> bool {
    extern "C-unwind" {
        fn CFURLCreateDataAndPropertiesFromResource(
            alloc: Option<&CFAllocator>,
            url: Option<&CFURL>,
            resource_data: *mut *const CFData,
            properties: *mut *const CFDictionary,
            desired_properties: Option<&CFArray>,
            error_code: *mut i32,
        ) -> Boolean;
    }
    let ret = unsafe {
        CFURLCreateDataAndPropertiesFromResource(
            alloc,
            url,
            resource_data,
            properties,
            desired_properties,
            error_code,
        )
    };
    ret != 0
}

#[cfg(all(feature = "CFData", feature = "CFDictionary", feature = "CFURL"))]
#[deprecated = "For resource data, use the CFWriteStream API. For file resource properties, use CFURLSetResourcePropertiesForKeys."]
#[inline]
pub unsafe extern "C-unwind" fn CFURLWriteDataAndPropertiesToResource(
    url: &CFURL,
    data_to_write: Option<&CFData>,
    properties_to_write: Option<&CFDictionary>,
    error_code: *mut i32,
) -> bool {
    extern "C-unwind" {
        fn CFURLWriteDataAndPropertiesToResource(
            url: &CFURL,
            data_to_write: Option<&CFData>,
            properties_to_write: Option<&CFDictionary>,
            error_code: *mut i32,
        ) -> Boolean;
    }
    let ret = unsafe {
        CFURLWriteDataAndPropertiesToResource(url, data_to_write, properties_to_write, error_code)
    };
    ret != 0
}

#[cfg(feature = "CFURL")]
#[deprecated = "Use CFURLGetFileSystemRepresentation and removefile(3) instead."]
#[inline]
pub unsafe extern "C-unwind" fn CFURLDestroyResource(url: &CFURL, error_code: *mut i32) -> bool {
    extern "C-unwind" {
        fn CFURLDestroyResource(url: &CFURL, error_code: *mut i32) -> Boolean;
    }
    let ret = unsafe { CFURLDestroyResource(url, error_code) };
    ret != 0
}

#[cfg(all(feature = "CFBase", feature = "CFURL"))]
#[deprecated = "For file resource properties, use CFURLCopyResourcePropertyForKey."]
#[inline]
pub unsafe extern "C-unwind" fn CFURLCreatePropertyFromResource(
    alloc: Option<&CFAllocator>,
    url: Option<&CFURL>,
    property: Option<&CFString>,
    error_code: *mut i32,
) -> Option<CFRetained<CFType>> {
    extern "C-unwind" {
        fn CFURLCreatePropertyFromResource(
            alloc: Option<&CFAllocator>,
            url: Option<&CFURL>,
            property: Option<&CFString>,
            error_code: *mut i32,
        ) -> Option<NonNull<CFType>>;
    }
    let ret = unsafe { CFURLCreatePropertyFromResource(alloc, url, property, error_code) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfurlerror?language=objc)
// NS_ENUM
#[cfg(feature = "CFBase")]
#[deprecated = "Use CFError codes instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CFURLError(pub CFIndex);
#[cfg(feature = "CFBase")]
impl CFURLError {
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLUnknownError")]
    pub const UnknownError: Self = Self(-10);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLUnknownSchemeError")]
    pub const UnknownSchemeError: Self = Self(-11);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLResourceNotFoundError")]
    pub const ResourceNotFoundError: Self = Self(-12);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLResourceAccessViolationError")]
    pub const ResourceAccessViolationError: Self = Self(-13);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLRemoteHostUnavailableError")]
    pub const RemoteHostUnavailableError: Self = Self(-14);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLImproperArgumentsError")]
    pub const ImproperArgumentsError: Self = Self(-15);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLUnknownPropertyKeyError")]
    pub const UnknownPropertyKeyError: Self = Self(-16);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLPropertyKeyUnavailableError")]
    pub const PropertyKeyUnavailableError: Self = Self(-17);
    #[deprecated = "Use CFError codes instead"]
    #[doc(alias = "kCFURLTimeoutError")]
    pub const TimeoutError: Self = Self(-18);
}

#[cfg(all(feature = "CFBase", feature = "objc2"))]
unsafe impl Encode for CFURLError {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(all(feature = "CFBase", feature = "objc2"))]
unsafe impl RefEncode for CFURLError {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlfileexists?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLFileExists: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlfiledirectorycontents?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLFileDirectoryContents: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlfilelength?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLFileLength: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlfilelastmodificationtime?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLFileLastModificationTime: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlfileposixmode?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLFilePOSIXMode: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlfileownerid?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLFileOwnerID: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlhttpstatuscode?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLHTTPStatusCode: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfurlhttpstatusline?language=objc)
    #[cfg(feature = "CFBase")]
    pub static kCFURLHTTPStatusLine: Option<&'static CFString>;
}
