#if OCTAGON
#import <CloudKit/CloudKit.h>
#import <Foundation/Foundation.h>
#import "keychain/ckks/CKKSNotifier.h"
#import "keychain/ckks/CloudKitDependencies.h"
NS_ASSUME_NONNULL_BEGIN
@class CKKSCKRecordHolder;
@class FakeCKZone;
typedef NSMutableDictionary<CKRecordZoneID*, FakeCKZone*> FakeCKDatabase;
@interface FakeCKModifyRecordZonesOperation : NSBlockOperation <CKKSModifyRecordZonesOperation> {
CKOperationConfiguration* _configuration;
}
@property (nullable) NSError* creationError;
@property (nonatomic, nullable) NSMutableArray<CKRecordZone*>* recordZonesSaved;
@property (nonatomic, nullable) NSMutableArray<CKRecordZoneID*>* recordZoneIDsDeleted;
@property (nonatomic, copy, null_resettable) CKOperationConfiguration *configuration;
+ (FakeCKDatabase*)ckdb;
+(void)ensureZoneDeletionAllowed:(FakeCKZone*)zone;
@end
@interface FakeCKModifySubscriptionsOperation : NSBlockOperation <CKKSModifySubscriptionsOperation> {
CKOperationConfiguration* _configuration;
}
@property (nullable) NSError* subscriptionError;
@property (nonatomic, nullable) NSMutableArray<CKSubscription*>* subscriptionsSaved;
@property (nonatomic, nullable) NSMutableArray<NSString*>* subscriptionIDsDeleted;
@property (nonatomic, copy, null_resettable) CKOperationConfiguration *configuration;
+ (FakeCKDatabase*)ckdb;
@end
@interface FakeCKFetchRecordZoneChangesOperation : NSOperation <CKKSFetchRecordZoneChangesOperation> {
CKOperationConfiguration* _configuration;
}
+ (FakeCKDatabase*)ckdb;
@property (nonatomic, copy) NSString *operationID;
@property (nonatomic, readonly, strong, nullable) CKOperationConfiguration *resolvedConfiguration;
@property (nullable) void (^blockAfterFetch)(void);
@end
@interface FakeCKFetchRecordsOperation : NSBlockOperation <CKKSFetchRecordsOperation>
+ (FakeCKDatabase*)ckdb;
@end
@interface FakeCKQueryOperation : NSBlockOperation <CKKSQueryOperation>
+ (FakeCKDatabase*)ckdb;
@end
@interface FakeAPSConnection : NSObject <CKKSAPSConnection>
@end
@interface FakeNSNotificationCenter : NSObject <CKKSNSNotificationCenter>
+ (instancetype)defaultCenter;
- (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName object:(nullable id)anObject;
@end
@interface FakeCKZone : NSObject
@property CKRecordZoneID* zoneID;
@property CKServerChangeToken* currentChangeToken;
@property NSMutableDictionary<CKRecordID*, CKRecord*>* currentDatabase;
@property NSMutableDictionary<CKServerChangeToken*, NSMutableDictionary<CKRecordID*, CKRecord*>*>* pastDatabases;
@property bool flag;
@property (nullable) NSError* creationError;
@property bool failCreationSilently;
@property (nullable) NSError* subscriptionError;
@property dispatch_queue_t queue;
- (instancetype)initZone:(CKRecordZoneID*)zoneID;
- (void)addToZone:(CKKSCKRecordHolder*)item zoneID:(CKRecordZoneID*)zoneID;
- (void)addToZone:(CKRecord*)record;
- (void)_onqueueAddToZone:(CKKSCKRecordHolder*)item zoneID:(CKRecordZoneID*)zoneID;
- (void)_onqueueAddToZone:(CKRecord*)record;
- (void)deleteFromHistory:(CKRecordID*)recordID;
- (void)addCKRecordToZone:(CKRecord*)record;
- (NSError* _Nullable)deleteCKRecordIDFromZone:(CKRecordID*)recordID;
- (void)failNextFetchWith:(NSError*)fetchChangesError;
- (NSError* _Nullable)popFetchChangesError;
- (NSError* _Nullable)errorFromSavingRecord:(CKRecord*)record;
@end
@interface FakeCKKSNotifier : NSObject <CKKSNotifier>
@end
NS_ASSUME_NONNULL_END
#endif