use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EKEventAvailability(pub NSInteger);
impl EKEventAvailability {
#[doc(alias = "EKEventAvailabilityNotSupported")]
pub const NotSupported: Self = Self(-1);
#[doc(alias = "EKEventAvailabilityBusy")]
pub const Busy: Self = Self(0);
#[doc(alias = "EKEventAvailabilityFree")]
pub const Free: Self = Self(1);
#[doc(alias = "EKEventAvailabilityTentative")]
pub const Tentative: Self = Self(2);
#[doc(alias = "EKEventAvailabilityUnavailable")]
pub const Unavailable: Self = Self(3);
}
unsafe impl Encode for EKEventAvailability {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for EKEventAvailability {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EKEventStatus(pub NSInteger);
impl EKEventStatus {
#[doc(alias = "EKEventStatusNone")]
pub const None: Self = Self(0);
#[doc(alias = "EKEventStatusConfirmed")]
pub const Confirmed: Self = Self(1);
#[doc(alias = "EKEventStatusTentative")]
pub const Tentative: Self = Self(2);
#[doc(alias = "EKEventStatusCanceled")]
pub const Canceled: Self = Self(3);
}
unsafe impl Encode for EKEventStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for EKEventStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "EKCalendarItem", feature = "EKObject"))]
pub struct EKEvent;
#[cfg(all(feature = "EKCalendarItem", feature = "EKObject"))]
unsafe impl ClassType for EKEvent {
#[inherits(EKObject, NSObject)]
type Super = EKCalendarItem;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "EKCalendarItem", feature = "EKObject"))]
unsafe impl NSObjectProtocol for EKEvent {}
extern_methods!(
#[cfg(all(feature = "EKCalendarItem", feature = "EKObject"))]
unsafe impl EKEvent {
#[cfg(feature = "EKEventStore")]
#[method_id(@__retain_semantics Other eventWithEventStore:)]
pub unsafe fn eventWithEventStore(event_store: &EKEventStore) -> Retained<EKEvent>;
#[method_id(@__retain_semantics Other eventIdentifier)]
pub unsafe fn eventIdentifier(&self) -> Option<Retained<NSString>>;
#[method(isAllDay)]
pub unsafe fn isAllDay(&self) -> bool;
#[method(setAllDay:)]
pub unsafe fn setAllDay(&self, all_day: bool);
#[method_id(@__retain_semantics Other startDate)]
pub unsafe fn startDate(&self) -> Retained<NSDate>;
#[method(setStartDate:)]
pub unsafe fn setStartDate(&self, start_date: Option<&NSDate>);
#[method_id(@__retain_semantics Other endDate)]
pub unsafe fn endDate(&self) -> Retained<NSDate>;
#[method(setEndDate:)]
pub unsafe fn setEndDate(&self, end_date: Option<&NSDate>);
#[cfg(feature = "EKStructuredLocation")]
#[method_id(@__retain_semantics Other structuredLocation)]
pub unsafe fn structuredLocation(&self) -> Option<Retained<EKStructuredLocation>>;
#[cfg(feature = "EKStructuredLocation")]
#[method(setStructuredLocation:)]
pub unsafe fn setStructuredLocation(
&self,
structured_location: Option<&EKStructuredLocation>,
);
#[method(compareStartDateWithEvent:)]
pub unsafe fn compareStartDateWithEvent(&self, other: &EKEvent) -> NSComparisonResult;
#[cfg(feature = "EKParticipant")]
#[method_id(@__retain_semantics Other organizer)]
pub unsafe fn organizer(&self) -> Option<Retained<EKParticipant>>;
#[method(availability)]
pub unsafe fn availability(&self) -> EKEventAvailability;
#[method(setAvailability:)]
pub unsafe fn setAvailability(&self, availability: EKEventAvailability);
#[method(status)]
pub unsafe fn status(&self) -> EKEventStatus;
#[method(isDetached)]
pub unsafe fn isDetached(&self) -> bool;
#[method_id(@__retain_semantics Other occurrenceDate)]
pub unsafe fn occurrenceDate(&self) -> Option<Retained<NSDate>>;
#[method(refresh)]
pub unsafe fn refresh(&self) -> bool;
#[method_id(@__retain_semantics Other birthdayContactIdentifier)]
pub unsafe fn birthdayContactIdentifier(&self) -> Option<Retained<NSString>>;
#[method(birthdayPersonID)]
pub unsafe fn birthdayPersonID(&self) -> NSInteger;
#[deprecated = "Use birthdayContactIdentifier instead"]
#[method_id(@__retain_semantics Other birthdayPersonUniqueID)]
pub unsafe fn birthdayPersonUniqueID(&self) -> Option<Retained<NSString>>;
}
);
extern_methods!(
#[cfg(all(feature = "EKCalendarItem", feature = "EKObject"))]
unsafe impl EKEvent {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);