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
159
160
161
162
163
164
165
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
#[cfg(feature = "block2")]
use block2::*;
use objc2::__framework_prelude::*;
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern "C" {
    pub static ASCredentialIdentityStoreErrorDomain: &'static NSErrorDomain;
}

// NS_ERROR_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialIdentityStoreErrorCode(pub NSInteger);
impl ASCredentialIdentityStoreErrorCode {
    #[doc(alias = "ASCredentialIdentityStoreErrorCodeInternalError")]
    pub const InternalError: Self = Self(0);
    #[doc(alias = "ASCredentialIdentityStoreErrorCodeStoreDisabled")]
    pub const StoreDisabled: Self = Self(1);
    #[doc(alias = "ASCredentialIdentityStoreErrorCodeStoreBusy")]
    pub const StoreBusy: Self = Self(2);
}

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

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASCredentialIdentityTypes(pub NSUInteger);
impl ASCredentialIdentityTypes {
    #[doc(alias = "ASCredentialIdentityTypesAll")]
    pub const All: Self = Self(0);
    #[doc(alias = "ASCredentialIdentityTypesPassword")]
    pub const Password: Self = Self(1);
    #[doc(alias = "ASCredentialIdentityTypesPasskey")]
    pub const Passkey: Self = Self(1 << 1);
}

unsafe impl Encode for ASCredentialIdentityTypes {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct ASCredentialIdentityStore;

    unsafe impl ClassType for ASCredentialIdentityStore {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for ASCredentialIdentityStore {}

extern_methods!(
    unsafe impl ASCredentialIdentityStore {
        #[method_id(@__retain_semantics Other sharedStore)]
        pub unsafe fn sharedStore() -> Id<ASCredentialIdentityStore>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[cfg(all(feature = "ASCredentialIdentityStoreState", feature = "block2"))]
        #[method(getCredentialIdentityStoreStateWithCompletion:)]
        pub unsafe fn getCredentialIdentityStoreStateWithCompletion(
            &self,
            completion: &Block<dyn Fn(NonNull<ASCredentialIdentityStoreState>)>,
        );

        #[cfg(all(
            feature = "ASCredentialIdentity",
            feature = "ASCredentialServiceIdentifier",
            feature = "block2"
        ))]
        #[method(getCredentialIdentitiesForService:credentialIdentityTypes:completionHandler:)]
        pub unsafe fn getCredentialIdentitiesForService_credentialIdentityTypes_completionHandler(
            &self,
            service_identifier: Option<&ASCredentialServiceIdentifier>,
            credential_identity_types: ASCredentialIdentityTypes,
            completion_handler: &Block<
                dyn Fn(NonNull<NSArray<ProtocolObject<dyn ASCredentialIdentity>>>),
            >,
        );

        #[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
        #[deprecated]
        #[method(saveCredentialIdentities:completion:)]
        pub unsafe fn saveCredentialIdentities_completion(
            &self,
            credential_identities: &NSArray<ASPasswordCredentialIdentity>,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
        #[method(saveCredentialIdentityEntries:completion:)]
        pub unsafe fn saveCredentialIdentityEntries_completion(
            &self,
            credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
        #[deprecated]
        #[method(removeCredentialIdentities:completion:)]
        pub unsafe fn removeCredentialIdentities_completion(
            &self,
            credential_identities: &NSArray<ASPasswordCredentialIdentity>,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
        #[method(removeCredentialIdentityEntries:completion:)]
        pub unsafe fn removeCredentialIdentityEntries_completion(
            &self,
            credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[method(removeAllCredentialIdentitiesWithCompletion:)]
        pub unsafe fn removeAllCredentialIdentitiesWithCompletion(
            &self,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(all(feature = "ASPasswordCredentialIdentity", feature = "block2"))]
        #[deprecated]
        #[method(replaceCredentialIdentitiesWithIdentities:completion:)]
        pub unsafe fn replaceCredentialIdentitiesWithIdentities_completion(
            &self,
            new_credential_identities: &NSArray<ASPasswordCredentialIdentity>,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );

        #[cfg(all(feature = "ASCredentialIdentity", feature = "block2"))]
        #[method(replaceCredentialIdentityEntries:completion:)]
        pub unsafe fn replaceCredentialIdentityEntries_completion(
            &self,
            new_credential_identities: &NSArray<ProtocolObject<dyn ASCredentialIdentity>>,
            completion: Option<&Block<dyn Fn(Bool, *mut NSError)>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl ASCredentialIdentityStore {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);