//! 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/corelocation/cldeviceorientation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLDeviceOrientation(pub c_int);
impl CLDeviceOrientation {
    #[doc(alias = "CLDeviceOrientationUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "CLDeviceOrientationPortrait")]
    pub const Portrait: Self = Self(1);
    #[doc(alias = "CLDeviceOrientationPortraitUpsideDown")]
    pub const PortraitUpsideDown: Self = Self(2);
    #[doc(alias = "CLDeviceOrientationLandscapeLeft")]
    pub const LandscapeLeft: Self = Self(3);
    #[doc(alias = "CLDeviceOrientationLandscapeRight")]
    pub const LandscapeRight: Self = Self(4);
    #[doc(alias = "CLDeviceOrientationFaceUp")]
    pub const FaceUp: Self = Self(5);
    #[doc(alias = "CLDeviceOrientationFaceDown")]
    pub const FaceDown: Self = Self(6);
}

unsafe impl Encode for CLDeviceOrientation {
    const ENCODING: Encoding = c_int::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clauthorizationstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLAuthorizationStatus(pub c_int);
impl CLAuthorizationStatus {
    #[doc(alias = "kCLAuthorizationStatusNotDetermined")]
    pub const NotDetermined: Self = Self(0);
    #[doc(alias = "kCLAuthorizationStatusRestricted")]
    pub const Restricted: Self = Self(1);
    #[doc(alias = "kCLAuthorizationStatusDenied")]
    pub const Denied: Self = Self(2);
    #[doc(alias = "kCLAuthorizationStatusAuthorizedAlways")]
    pub const AuthorizedAlways: Self = Self(3);
    #[doc(alias = "kCLAuthorizationStatusAuthorizedWhenInUse")]
    pub const AuthorizedWhenInUse: Self = Self(4);
    #[doc(alias = "kCLAuthorizationStatusAuthorized")]
    #[deprecated = "Use kCLAuthorizationStatusAuthorizedAlways"]
    pub const Authorized: Self = Self(CLAuthorizationStatus::AuthorizedAlways.0);
}

unsafe impl Encode for CLAuthorizationStatus {
    const ENCODING: Encoding = c_int::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/claccuracyauthorization?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLAccuracyAuthorization(pub NSInteger);
impl CLAccuracyAuthorization {
    #[doc(alias = "CLAccuracyAuthorizationFullAccuracy")]
    pub const FullAccuracy: Self = Self(0);
    #[doc(alias = "CLAccuracyAuthorizationReducedAccuracy")]
    pub const ReducedAccuracy: Self = Self(1);
}

unsafe impl Encode for CLAccuracyAuthorization {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clactivitytype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLActivityType(pub NSInteger);
impl CLActivityType {
    #[doc(alias = "CLActivityTypeOther")]
    pub const Other: Self = Self(1);
    #[doc(alias = "CLActivityTypeAutomotiveNavigation")]
    pub const AutomotiveNavigation: Self = Self(2);
    #[doc(alias = "CLActivityTypeFitness")]
    pub const Fitness: Self = Self(3);
    #[doc(alias = "CLActivityTypeOtherNavigation")]
    pub const OtherNavigation: Self = Self(4);
    #[doc(alias = "CLActivityTypeAirborne")]
    pub const Airborne: Self = Self(5);
}

unsafe impl Encode for CLActivityType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

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

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

impl CLLocationManager {
    extern_methods!(
        #[unsafe(method(locationServicesEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn locationServicesEnabled_class() -> bool;

        #[unsafe(method(headingAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn headingAvailable_class() -> bool;

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

        /// # Safety
        ///
        /// `region_class` probably has further requirements.
        #[unsafe(method(isMonitoringAvailableForClass:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isMonitoringAvailableForClass(region_class: &AnyClass) -> bool;

        #[deprecated]
        #[unsafe(method(regionMonitoringAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn regionMonitoringAvailable() -> bool;

        #[deprecated = "Use +isMonitoringAvailableForClass: and -authorizationStatus instead"]
        #[unsafe(method(regionMonitoringEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn regionMonitoringEnabled() -> bool;

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

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

        #[deprecated]
        #[unsafe(method(authorizationStatus))]
        #[unsafe(method_family = none)]
        pub unsafe fn authorizationStatus_class() -> CLAuthorizationStatus;

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

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

        #[cfg(feature = "CLLocationManagerDelegate")]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn CLLocationManagerDelegate>>>;

        #[cfg(feature = "CLLocationManagerDelegate")]
        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn CLLocationManagerDelegate>>,
        );

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

        #[deprecated = "Set the purpose string in Info.plist using key NSLocationUsageDescription"]
        #[unsafe(method(purpose))]
        #[unsafe(method_family = none)]
        pub unsafe fn purpose(&self) -> Option<Retained<NSString>>;

        /// Setter for [`purpose`][Self::purpose].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "Set the purpose string in Info.plist using key NSLocationUsageDescription"]
        #[unsafe(method(setPurpose:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPurpose(&self, purpose: Option<&NSString>);

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

        /// Setter for [`activityType`][Self::activityType].
        #[unsafe(method(setActivityType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActivityType(&self, activity_type: CLActivityType);

        #[cfg(feature = "CLLocation")]
        #[unsafe(method(distanceFilter))]
        #[unsafe(method_family = none)]
        pub unsafe fn distanceFilter(&self) -> CLLocationDistance;

        #[cfg(feature = "CLLocation")]
        /// Setter for [`distanceFilter`][Self::distanceFilter].
        #[unsafe(method(setDistanceFilter:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDistanceFilter(&self, distance_filter: CLLocationDistance);

        #[cfg(feature = "CLLocation")]
        #[unsafe(method(desiredAccuracy))]
        #[unsafe(method_family = none)]
        pub unsafe fn desiredAccuracy(&self) -> CLLocationAccuracy;

        #[cfg(feature = "CLLocation")]
        /// Setter for [`desiredAccuracy`][Self::desiredAccuracy].
        #[unsafe(method(setDesiredAccuracy:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDesiredAccuracy(&self, desired_accuracy: CLLocationAccuracy);

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

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

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

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

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

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

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

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

        #[cfg(feature = "CLLocation")]
        #[unsafe(method(headingFilter))]
        #[unsafe(method_family = none)]
        pub unsafe fn headingFilter(&self) -> CLLocationDegrees;

        #[cfg(feature = "CLLocation")]
        /// Setter for [`headingFilter`][Self::headingFilter].
        #[unsafe(method(setHeadingFilter:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeadingFilter(&self, heading_filter: CLLocationDegrees);

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

        /// Setter for [`headingOrientation`][Self::headingOrientation].
        #[unsafe(method(setHeadingOrientation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeadingOrientation(&self, heading_orientation: CLDeviceOrientation);

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

        #[cfg(feature = "CLLocation")]
        #[unsafe(method(maximumRegionMonitoringDistance))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumRegionMonitoringDistance(&self) -> CLLocationDistance;

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

        #[cfg(feature = "CLRegion")]
        #[deprecated = "Use -rangedBeaconConstraints"]
        #[unsafe(method(rangedRegions))]
        #[unsafe(method_family = none)]
        pub unsafe fn rangedRegions(&self) -> Retained<NSSet<CLRegion>>;

        #[cfg(all(
            feature = "CLBeaconIdentityCondition",
            feature = "CLBeaconIdentityConstraint",
            feature = "CLCondition"
        ))]
        #[unsafe(method(rangedBeaconConstraints))]
        #[unsafe(method_family = none)]
        pub unsafe fn rangedBeaconConstraints(&self)
            -> Retained<NSSet<CLBeaconIdentityConstraint>>;

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

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

        #[cfg(feature = "block2")]
        #[unsafe(method(requestTemporaryFullAccuracyAuthorizationWithPurposeKey:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestTemporaryFullAccuracyAuthorizationWithPurposeKey_completion(
            &self,
            purpose_key: &NSString,
            completion: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[unsafe(method(requestTemporaryFullAccuracyAuthorizationWithPurposeKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestTemporaryFullAccuracyAuthorizationWithPurposeKey(
            &self,
            purpose_key: &NSString,
        );

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

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

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

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

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

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

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

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

        #[cfg(feature = "block2")]
        #[unsafe(method(startMonitoringLocationPushesWithCompletion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startMonitoringLocationPushesWithCompletion(
            &self,
            completion: Option<&block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>>,
        );

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

        #[cfg(all(feature = "CLLocation", feature = "CLRegion"))]
        #[deprecated]
        #[unsafe(method(startMonitoringForRegion:desiredAccuracy:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startMonitoringForRegion_desiredAccuracy(
            &self,
            region: &CLRegion,
            accuracy: CLLocationAccuracy,
        );

        #[cfg(feature = "CLRegion")]
        #[deprecated]
        #[unsafe(method(stopMonitoringForRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopMonitoringForRegion(&self, region: &CLRegion);

        #[cfg(feature = "CLRegion")]
        #[deprecated]
        #[unsafe(method(startMonitoringForRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startMonitoringForRegion(&self, region: &CLRegion);

        #[cfg(feature = "CLRegion")]
        #[deprecated]
        #[unsafe(method(requestStateForRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestStateForRegion(&self, region: &CLRegion);

        #[cfg(all(feature = "CLBeaconRegion", feature = "CLRegion"))]
        #[deprecated = "Use -startRangingBeaconsSatisfyingConstraint:"]
        #[unsafe(method(startRangingBeaconsInRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startRangingBeaconsInRegion(&self, region: &CLBeaconRegion);

        #[cfg(all(feature = "CLBeaconRegion", feature = "CLRegion"))]
        #[deprecated = "Use -stopRangingBeaconsSatisfyingConstraint:"]
        #[unsafe(method(stopRangingBeaconsInRegion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopRangingBeaconsInRegion(&self, region: &CLBeaconRegion);

        #[cfg(all(
            feature = "CLBeaconIdentityCondition",
            feature = "CLBeaconIdentityConstraint",
            feature = "CLCondition"
        ))]
        #[unsafe(method(startRangingBeaconsSatisfyingConstraint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startRangingBeaconsSatisfyingConstraint(
            &self,
            constraint: &CLBeaconIdentityConstraint,
        );

        #[cfg(all(
            feature = "CLBeaconIdentityCondition",
            feature = "CLBeaconIdentityConstraint",
            feature = "CLCondition"
        ))]
        #[unsafe(method(stopRangingBeaconsSatisfyingConstraint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopRangingBeaconsSatisfyingConstraint(
            &self,
            constraint: &CLBeaconIdentityConstraint,
        );

        #[cfg(feature = "CLLocation")]
        #[deprecated = "You can remove calls to this method"]
        #[unsafe(method(allowDeferredLocationUpdatesUntilTraveled:timeout:))]
        #[unsafe(method_family = none)]
        pub unsafe fn allowDeferredLocationUpdatesUntilTraveled_timeout(
            &self,
            distance: CLLocationDistance,
            timeout: NSTimeInterval,
        );

        #[deprecated = "You can remove calls to this method"]
        #[unsafe(method(disallowDeferredLocationUpdates))]
        #[unsafe(method_family = none)]
        pub unsafe fn disallowDeferredLocationUpdates(&self);

        #[deprecated = "You can remove calls to this method"]
        #[unsafe(method(deferredLocationUpdatesAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn deferredLocationUpdatesAvailable() -> bool;

        #[cfg(all(feature = "CLLocation", feature = "block2"))]
        #[unsafe(method(requestHistoricalLocationsWithPurposeKey:sampleCount:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestHistoricalLocationsWithPurposeKey_sampleCount_completionHandler(
            &self,
            purpose_key: &NSString,
            sample_count: NSInteger,
            handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<CLLocation>>, *mut NSError)>,
        );
    );
}

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