1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[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);
}

// NS_ENUM
#[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!(
    /// Methods declared on superclass `NSObject`
    #[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>;
    }
);