use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SAEmergencyResponseManagerVoiceCallStatus(pub NSInteger);
impl SAEmergencyResponseManagerVoiceCallStatus {
#[doc(alias = "SAEmergencyResponseManagerVoiceCallStatusDialing")]
pub const Dialing: Self = Self(0);
#[doc(alias = "SAEmergencyResponseManagerVoiceCallStatusActive")]
pub const Active: Self = Self(1);
#[doc(alias = "SAEmergencyResponseManagerVoiceCallStatusDisconnected")]
pub const Disconnected: Self = Self(2);
#[doc(alias = "SAEmergencyResponseManagerVoiceCallStatusFailed")]
pub const Failed: Self = Self(3);
}
unsafe impl Encode for SAEmergencyResponseManagerVoiceCallStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for SAEmergencyResponseManagerVoiceCallStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SAEmergencyResponseManager;
);
extern_conformance!(
unsafe impl NSObjectProtocol for SAEmergencyResponseManager {}
);
impl SAEmergencyResponseManager {
extern_methods!(
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn SAEmergencyResponseDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn SAEmergencyResponseDelegate>>,
);
#[cfg(feature = "block2")]
#[unsafe(method(dialVoiceCallToPhoneNumber:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn dialVoiceCallToPhoneNumber_completionHandler(
&self,
phone_number: &NSString,
handler: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
);
);
}
impl SAEmergencyResponseManager {
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_protocol!(
pub unsafe trait SAEmergencyResponseDelegate: NSObjectProtocol {
#[optional]
#[unsafe(method(emergencyResponseManager:didUpdateVoiceCallStatus:))]
#[unsafe(method_family = none)]
unsafe fn emergencyResponseManager_didUpdateVoiceCallStatus(
&self,
emergency_response_manager: &SAEmergencyResponseManager,
voice_call_status: SAEmergencyResponseManagerVoiceCallStatus,
);
}
);