//! 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::*;
#[cfg(feature = "objc2-contacts")]
#[cfg(not(target_os = "tvos"))]
use objc2_contacts::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clgeocodecompletionhandler?language=objc)
#[cfg(all(feature = "CLPlacemark", feature = "block2"))]
pub type CLGeocodeCompletionHandler =
    *mut block2::DynBlock<dyn Fn(*mut NSArray<CLPlacemark>, *mut NSError)>;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clgeocoder?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use MapKit"]
    pub struct CLGeocoder;
);

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

impl CLGeocoder {
    extern_methods!(
        #[deprecated = "Use MapKit"]
        #[unsafe(method(isGeocoding))]
        #[unsafe(method_family = none)]
        pub unsafe fn isGeocoding(&self) -> bool;

        #[cfg(all(feature = "CLLocation", feature = "CLPlacemark", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKReverseGeocodingRequest"]
        #[unsafe(method(reverseGeocodeLocation:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn reverseGeocodeLocation_completionHandler(
            &self,
            location: &CLLocation,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(feature = "CLLocation", feature = "CLPlacemark", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKReverseGeocodingRequest"]
        #[unsafe(method(reverseGeocodeLocation:preferredLocale:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn reverseGeocodeLocation_preferredLocale_completionHandler(
            &self,
            location: &CLLocation,
            locale: Option<&NSLocale>,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(feature = "CLPlacemark", feature = "block2"))]
        /// # Safety
        ///
        /// - `address_dictionary` generic should be of the correct type.
        /// - `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKReverseGeocodingRequest"]
        #[unsafe(method(geocodeAddressDictionary:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodeAddressDictionary_completionHandler(
            &self,
            address_dictionary: &NSDictionary,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(feature = "CLPlacemark", feature = "CLRegion", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[unsafe(method(geocodeAddressString:inRegion:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodeAddressString_inRegion_completionHandler(
            &self,
            address_string: &NSString,
            region: Option<&CLRegion>,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(feature = "CLPlacemark", feature = "CLRegion", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKGeocodingRequest"]
        #[unsafe(method(geocodeAddressString:inRegion:preferredLocale:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodeAddressString_inRegion_preferredLocale_completionHandler(
            &self,
            address_string: &NSString,
            region: Option<&CLRegion>,
            locale: Option<&NSLocale>,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(feature = "CLLocation", feature = "CLPlacemark", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKGeocodingRequest"]
        #[unsafe(method(geocodeAddressString:inRegionCenteredAt:inRegionRadius:preferredLocale:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodeAddressString_inRegionCenteredAt_inRegionRadius_preferredLocale_completionHandler(
            &self,
            address_string: &NSString,
            centroid: CLLocationCoordinate2D,
            radius: CLLocationDistance,
            locale: Option<&NSLocale>,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(feature = "CLPlacemark", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKGeocodingRequest"]
        #[unsafe(method(geocodeAddressString:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodeAddressString_completionHandler(
            &self,
            address_string: &NSString,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[deprecated = "Use MKGeocodingRequest"]
        #[unsafe(method(cancelGeocode))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelGeocode(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl CLGeocoder {
    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>;
    );
}

/// ContactsAdditions.
#[deprecated = "Use MapKit"]
impl CLGeocoder {
    extern_methods!(
        #[cfg(all(
            feature = "CLPlacemark",
            feature = "block2",
            feature = "objc2-contacts"
        ))]
        #[cfg(not(target_os = "tvos"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKReverseGeocodingRequest"]
        #[unsafe(method(geocodePostalAddress:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodePostalAddress_completionHandler(
            &self,
            postal_address: &CNPostalAddress,
            completion_handler: CLGeocodeCompletionHandler,
        );

        #[cfg(all(
            feature = "CLPlacemark",
            feature = "block2",
            feature = "objc2-contacts"
        ))]
        #[cfg(not(target_os = "tvos"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[deprecated = "Use MKReverseGeocodingRequest"]
        #[unsafe(method(geocodePostalAddress:preferredLocale:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn geocodePostalAddress_preferredLocale_completionHandler(
            &self,
            postal_address: &CNPostalAddress,
            locale: Option<&NSLocale>,
            completion_handler: CLGeocodeCompletionHandler,
        );
    );
}
