use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct HKStatisticsCollection;
);
unsafe impl Send for HKStatisticsCollection {}
unsafe impl Sync for HKStatisticsCollection {}
extern_conformance!(
unsafe impl NSObjectProtocol for HKStatisticsCollection {}
);
impl HKStatisticsCollection {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "HKStatistics")]
#[unsafe(method(statisticsForDate:))]
#[unsafe(method_family = none)]
pub unsafe fn statisticsForDate(&self, date: &NSDate) -> Option<Retained<HKStatistics>>;
#[cfg(all(feature = "HKStatistics", feature = "block2"))]
#[unsafe(method(enumerateStatisticsFromDate:toDate:withBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateStatisticsFromDate_toDate_withBlock(
&self,
start_date: &NSDate,
end_date: &NSDate,
block: &block2::DynBlock<dyn Fn(NonNull<HKStatistics>, NonNull<Bool>)>,
);
#[cfg(feature = "HKStatistics")]
#[unsafe(method(statistics))]
#[unsafe(method_family = none)]
pub unsafe fn statistics(&self) -> Retained<NSArray<HKStatistics>>;
#[cfg(feature = "HKSource")]
#[unsafe(method(sources))]
#[unsafe(method_family = none)]
pub unsafe fn sources(&self) -> Retained<NSSet<HKSource>>;
);
}
impl HKStatisticsCollection {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(HKQuery, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "HKQuery")]
pub struct HKStatisticsCollectionQuery;
);
#[cfg(feature = "HKQuery")]
unsafe impl Send for HKStatisticsCollectionQuery {}
#[cfg(feature = "HKQuery")]
unsafe impl Sync for HKStatisticsCollectionQuery {}
#[cfg(feature = "HKQuery")]
extern_conformance!(
unsafe impl NSObjectProtocol for HKStatisticsCollectionQuery {}
);
#[cfg(feature = "HKQuery")]
impl HKStatisticsCollectionQuery {
extern_methods!(
#[unsafe(method(anchorDate))]
#[unsafe(method_family = none)]
pub unsafe fn anchorDate(&self) -> Retained<NSDate>;
#[cfg(feature = "HKStatistics")]
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub unsafe fn options(&self) -> HKStatisticsOptions;
#[unsafe(method(intervalComponents))]
#[unsafe(method_family = none)]
pub unsafe fn intervalComponents(&self) -> Retained<NSDateComponents>;
#[cfg(feature = "block2")]
#[unsafe(method(initialResultsHandler))]
#[unsafe(method_family = none)]
pub unsafe fn initialResultsHandler(
&self,
) -> *mut block2::DynBlock<
dyn Fn(NonNull<HKStatisticsCollectionQuery>, *mut HKStatisticsCollection, *mut NSError),
>;
#[cfg(feature = "block2")]
#[unsafe(method(setInitialResultsHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setInitialResultsHandler(
&self,
initial_results_handler: Option<
&block2::DynBlock<
dyn Fn(
NonNull<HKStatisticsCollectionQuery>,
*mut HKStatisticsCollection,
*mut NSError,
),
>,
>,
);
#[cfg(all(feature = "HKStatistics", feature = "block2"))]
#[unsafe(method(statisticsUpdateHandler))]
#[unsafe(method_family = none)]
pub unsafe fn statisticsUpdateHandler(
&self,
) -> *mut block2::DynBlock<
dyn Fn(
NonNull<HKStatisticsCollectionQuery>,
*mut HKStatistics,
*mut HKStatisticsCollection,
*mut NSError,
),
>;
#[cfg(all(feature = "HKStatistics", feature = "block2"))]
#[unsafe(method(setStatisticsUpdateHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setStatisticsUpdateHandler(
&self,
statistics_update_handler: Option<
&block2::DynBlock<
dyn Fn(
NonNull<HKStatisticsCollectionQuery>,
*mut HKStatistics,
*mut HKStatisticsCollection,
*mut NSError,
),
>,
>,
);
#[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
#[unsafe(method(initWithQuantityType:quantitySamplePredicate:options:anchorDate:intervalComponents:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithQuantityType_quantitySamplePredicate_options_anchorDate_intervalComponents(
this: Allocated<Self>,
quantity_type: &HKQuantityType,
quantity_sample_predicate: Option<&NSPredicate>,
options: HKStatisticsOptions,
anchor_date: &NSDate,
interval_components: &NSDateComponents,
) -> Retained<Self>;
);
}
#[cfg(feature = "HKQuery")]
impl HKStatisticsCollectionQuery {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(feature = "HKQuery")]
impl HKStatisticsCollectionQuery {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}