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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clservicesessionauthorizationrequirement?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CLServiceSessionAuthorizationRequirement(pub NSInteger);
impl CLServiceSessionAuthorizationRequirement {
    #[doc(alias = "CLServiceSessionAuthorizationRequirementNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "CLServiceSessionAuthorizationRequirementWhenInUse")]
    pub const WhenInUse: Self = Self(1);
    #[doc(alias = "CLServiceSessionAuthorizationRequirementAlways")]
    pub const Always: Self = Self(2);
}

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

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

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

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

impl CLServiceSessionDiagnostic {
    extern_methods!(
        #[unsafe(method(authorizationDenied))]
        #[unsafe(method_family = none)]
        pub unsafe fn authorizationDenied(&self) -> bool;

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

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

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

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

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

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

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

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

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

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

impl CLServiceSession {
    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>;

        #[unsafe(method(sessionRequiringAuthorization:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sessionRequiringAuthorization(
            authorization_requirement: CLServiceSessionAuthorizationRequirement,
        ) -> Retained<CLServiceSession>;

        #[cfg(all(feature = "block2", feature = "dispatch2"))]
        /// # Safety
        ///
        /// `queue` possibly has additional threading requirements.
        #[unsafe(method(sessionRequiringAuthorization:queue:handler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sessionRequiringAuthorization_queue_handler(
            authorization_requirement: CLServiceSessionAuthorizationRequirement,
            queue: &DispatchQueue,
            handler: &block2::DynBlock<dyn Fn(NonNull<CLServiceSessionDiagnostic>)>,
        ) -> Retained<CLServiceSession>;

        #[unsafe(method(sessionRequiringAuthorization:fullAccuracyPurposeKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sessionRequiringAuthorization_fullAccuracyPurposeKey(
            authorization_requirement: CLServiceSessionAuthorizationRequirement,
            purpose_key: &NSString,
        ) -> Retained<CLServiceSession>;

        #[cfg(all(feature = "block2", feature = "dispatch2"))]
        /// # Safety
        ///
        /// `queue` possibly has additional threading requirements.
        #[unsafe(method(sessionRequiringAuthorization:fullAccuracyPurposeKey:queue:handler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sessionRequiringAuthorization_fullAccuracyPurposeKey_queue_handler(
            authorization_requirement: CLServiceSessionAuthorizationRequirement,
            purpose_key: &NSString,
            queue: &DispatchQueue,
            handler: &block2::DynBlock<dyn Fn(NonNull<CLServiceSessionDiagnostic>)>,
        ) -> Retained<CLServiceSession>;

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