#if OCTAGON
#import <CloudKit/CloudKit.h>
#include "keychain/securityd/SecDbItem.h"
#include <utilities/SecDb.h>
#import "keychain/ckks/CKKS.h"
#import "keychain/ckks/CKKSRecordHolder.h"
#import "keychain/ckks/CKKSSQLDatabaseObject.h"
NS_ASSUME_NONNULL_BEGIN
@class CKKSWrappedAESSIVKey;
@interface CKKSItem : CKKSCKRecordHolder
@property (copy) NSString* uuid;
@property (copy) NSString* parentKeyUUID;
@property (nullable, copy) NSData* encitem;
@property (nullable, getter=base64Item, setter=setBase64Item:) NSString* base64encitem;
@property (nullable, copy) CKKSWrappedAESSIVKey* wrappedkey;
@property NSUInteger generationCount;
@property enum SecCKKSItemEncryptionVersion encver;
@property (nullable) NSNumber* plaintextPCSServiceIdentifier;
@property (nullable) NSData* plaintextPCSPublicKey;
@property (nullable) NSData* plaintextPCSPublicIdentity;
- (NSDictionary<NSString*, NSData*>*)makeAuthenticatedDataDictionaryUpdatingCKKSItem:(CKKSItem* _Nullable)olditem
encryptionVersion:(SecCKKSItemEncryptionVersion)encversion;
- (instancetype)initWithCKRecord:(CKRecord*)record;
- (instancetype)initCopyingCKKSItem:(CKKSItem*)item;
- (instancetype)initWithUUID:(NSString*)uuid parentKeyUUID:(NSString*)parentKeyUUID zoneID:(CKRecordZoneID*)zoneID;
- (instancetype)initWithUUID:(NSString*)uuid
parentKeyUUID:(NSString*)parentKeyUUID
zoneID:(CKRecordZoneID*)zoneID
encItem:(NSData* _Nullable)encitem
wrappedkey:(CKKSWrappedAESSIVKey* _Nullable)wrappedkey
generationCount:(NSUInteger)genCount
encver:(NSUInteger)encver;
- (instancetype)initWithUUID:(NSString*)uuid
parentKeyUUID:(NSString*)parentKeyUUID
zoneID:(CKRecordZoneID*)zoneID
encodedCKRecord:(NSData* _Nullable)encodedrecord
encItem:(NSData* _Nullable)encitem
wrappedkey:(CKKSWrappedAESSIVKey* _Nullable)wrappedkey
generationCount:(NSUInteger)genCount
encver:(NSUInteger)encver;
- (instancetype)initWithUUID:(NSString*)uuid
parentKeyUUID:(NSString*)parentKeyUUID
zoneID:(CKRecordZoneID*)zoneID
encodedCKRecord:(NSData* _Nullable)encodedrecord
encItem:(NSData* _Nullable)encitem
wrappedkey:(CKKSWrappedAESSIVKey* _Nullable)wrappedkey
generationCount:(NSUInteger)genCount
encver:(NSUInteger)encver
plaintextPCSServiceIdentifier:(NSNumber* _Nullable)pcsServiceIdentifier
plaintextPCSPublicKey:(NSData* _Nullable)pcsPublicKey
plaintextPCSPublicIdentity:(NSData* _Nullable)pcsPublicIdentity;
+ (void)setOSVersionInRecord:(CKRecord*)record;
+ (BOOL)intransactionRecordChanged:(CKRecord*)record resync:(BOOL)resync error:(NSError**)error;
+ (BOOL)intransactionRecordDeleted:(CKRecordID*)recordID resync:(BOOL)resync error:(NSError**)error;
@end
@interface CKKSSQLDatabaseObject (CKKSZoneExtras)
+ (NSArray<NSString*>*)allUUIDs:(CKRecordZoneID*)zoneID error:(NSError * __autoreleasing *)error;
+ (NSArray*)all:(CKRecordZoneID*)zoneID error:(NSError* _Nullable __autoreleasing* _Nullable)error;
+ (bool)deleteAll:(CKRecordZoneID*)zoneID error:(NSError* _Nullable __autoreleasing* _Nullable)error;
@end
NS_ASSUME_NONNULL_END
#endif