OTAccountMetadataClassC.h   [plain text]


// This file was automatically generated by protocompiler
// DO NOT EDIT!
// Compiled from OTAccountMetadataClassC.proto

#import <Foundation/Foundation.h>
#import <ProtocolBuffer/PBCodable.h>

/**
 * The state of accounts on the system is complicated. Here's how we handle them:
 *  If there is no account, we will be in NO_ACCOUNT and have no altDSID
 *  If there is an SA account, we will bt in NO_ACCOUNT and have an altDSID
 *  If there is an HSA2 account, we will be in ACCOUNT_AVAILABLE and have an altDSID
 */
typedef NS_ENUM(int32_t, OTAccountMetadataClassC_AccountState) {
    OTAccountMetadataClassC_AccountState_UNKNOWN = 0,
    OTAccountMetadataClassC_AccountState_NO_ACCOUNT = 1,
    OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE = 2,
    OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE_UNUSED = 3,
};
#ifdef __OBJC__
NS_INLINE NSString *OTAccountMetadataClassC_AccountStateAsString(OTAccountMetadataClassC_AccountState value)
{
    switch (value)
    {
        case OTAccountMetadataClassC_AccountState_UNKNOWN: return @"UNKNOWN";
        case OTAccountMetadataClassC_AccountState_NO_ACCOUNT: return @"NO_ACCOUNT";
        case OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE: return @"ACCOUNT_AVAILABLE";
        case OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE_UNUSED: return @"ACCOUNT_AVAILABLE_UNUSED";
        default: return [NSString stringWithFormat:@"(unknown: %i)", value];
    }
}
#endif /* __OBJC__ */
#ifdef __OBJC__
NS_INLINE OTAccountMetadataClassC_AccountState StringAsOTAccountMetadataClassC_AccountState(NSString *value)
{
    if ([value isEqualToString:@"UNKNOWN"]) return OTAccountMetadataClassC_AccountState_UNKNOWN;
    if ([value isEqualToString:@"NO_ACCOUNT"]) return OTAccountMetadataClassC_AccountState_NO_ACCOUNT;
    if ([value isEqualToString:@"ACCOUNT_AVAILABLE"]) return OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE;
    if ([value isEqualToString:@"ACCOUNT_AVAILABLE_UNUSED"]) return OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE_UNUSED;
    return OTAccountMetadataClassC_AccountState_UNKNOWN;
}
#endif /* __OBJC__ */
typedef NS_ENUM(int32_t, OTAccountMetadataClassC_TrustState) {
    OTAccountMetadataClassC_TrustState_UNKNOWN = 0,
    OTAccountMetadataClassC_TrustState_UNTRUSTED = 1,
    OTAccountMetadataClassC_TrustState_TRUSTED = 2,
};
#ifdef __OBJC__
NS_INLINE NSString *OTAccountMetadataClassC_TrustStateAsString(OTAccountMetadataClassC_TrustState value)
{
    switch (value)
    {
        case OTAccountMetadataClassC_TrustState_UNKNOWN: return @"UNKNOWN";
        case OTAccountMetadataClassC_TrustState_UNTRUSTED: return @"UNTRUSTED";
        case OTAccountMetadataClassC_TrustState_TRUSTED: return @"TRUSTED";
        default: return [NSString stringWithFormat:@"(unknown: %i)", value];
    }
}
#endif /* __OBJC__ */
#ifdef __OBJC__
NS_INLINE OTAccountMetadataClassC_TrustState StringAsOTAccountMetadataClassC_TrustState(NSString *value)
{
    if ([value isEqualToString:@"UNKNOWN"]) return OTAccountMetadataClassC_TrustState_UNKNOWN;
    if ([value isEqualToString:@"UNTRUSTED"]) return OTAccountMetadataClassC_TrustState_UNTRUSTED;
    if ([value isEqualToString:@"TRUSTED"]) return OTAccountMetadataClassC_TrustState_TRUSTED;
    return OTAccountMetadataClassC_TrustState_UNKNOWN;
}
#endif /* __OBJC__ */
typedef NS_ENUM(int32_t, OTAccountMetadataClassC_AttemptedAJoinState) {
    OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN = 0,
    OTAccountMetadataClassC_AttemptedAJoinState_NOTATTEMPTED = 1,
    OTAccountMetadataClassC_AttemptedAJoinState_ATTEMPTED = 2,
};
#ifdef __OBJC__
NS_INLINE NSString *OTAccountMetadataClassC_AttemptedAJoinStateAsString(OTAccountMetadataClassC_AttemptedAJoinState value)
{
    switch (value)
    {
        case OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN: return @"UNKNOWN";
        case OTAccountMetadataClassC_AttemptedAJoinState_NOTATTEMPTED: return @"NOTATTEMPTED";
        case OTAccountMetadataClassC_AttemptedAJoinState_ATTEMPTED: return @"ATTEMPTED";
        default: return [NSString stringWithFormat:@"(unknown: %i)", value];
    }
}
#endif /* __OBJC__ */
#ifdef __OBJC__
NS_INLINE OTAccountMetadataClassC_AttemptedAJoinState StringAsOTAccountMetadataClassC_AttemptedAJoinState(NSString *value)
{
    if ([value isEqualToString:@"UNKNOWN"]) return OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN;
    if ([value isEqualToString:@"NOTATTEMPTED"]) return OTAccountMetadataClassC_AttemptedAJoinState_NOTATTEMPTED;
    if ([value isEqualToString:@"ATTEMPTED"]) return OTAccountMetadataClassC_AttemptedAJoinState_ATTEMPTED;
    return OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN;
}
#endif /* __OBJC__ */

#ifdef __cplusplus
#define OTACCOUNTMETADATACLASSC_FUNCTION extern "C" __attribute__((visibility("hidden")))
#else
#define OTACCOUNTMETADATACLASSC_FUNCTION extern __attribute__((visibility("hidden")))
#endif

__attribute__((visibility("hidden")))
@interface OTAccountMetadataClassC : PBCodable <NSCopying>
{
    int64_t _epoch;
    uint64_t _lastHealthCheckup;
    NSString *_altDSID;
    OTAccountMetadataClassC_AttemptedAJoinState _attemptedJoin;
    OTAccountMetadataClassC_AccountState _icloudAccountState;
    NSString *_peerID;
    OTAccountMetadataClassC_TrustState _trustState;
    struct {
        int epoch:1;
        int lastHealthCheckup:1;
        int attemptedJoin:1;
        int icloudAccountState:1;
        int trustState:1;
    } _has;
}


@property (nonatomic, readonly) BOOL hasPeerID;
@property (nonatomic, retain) NSString *peerID;

@property (nonatomic) BOOL hasIcloudAccountState;
@property (nonatomic) OTAccountMetadataClassC_AccountState icloudAccountState;
- (NSString *)icloudAccountStateAsString:(OTAccountMetadataClassC_AccountState)value;
- (OTAccountMetadataClassC_AccountState)StringAsIcloudAccountState:(NSString *)str;

@property (nonatomic) BOOL hasEpoch;
@property (nonatomic) int64_t epoch;

@property (nonatomic, readonly) BOOL hasAltDSID;
@property (nonatomic, retain) NSString *altDSID;

@property (nonatomic) BOOL hasTrustState;
@property (nonatomic) OTAccountMetadataClassC_TrustState trustState;
- (NSString *)trustStateAsString:(OTAccountMetadataClassC_TrustState)value;
- (OTAccountMetadataClassC_TrustState)StringAsTrustState:(NSString *)str;

@property (nonatomic) BOOL hasLastHealthCheckup;
/** Holds the time, in milliseconds since 1970, that the last health checkup query to Cuttlefish was successfully performed */
@property (nonatomic) uint64_t lastHealthCheckup;

@property (nonatomic) BOOL hasAttemptedJoin;
@property (nonatomic) OTAccountMetadataClassC_AttemptedAJoinState attemptedJoin;
- (NSString *)attemptedJoinAsString:(OTAccountMetadataClassC_AttemptedAJoinState)value;
- (OTAccountMetadataClassC_AttemptedAJoinState)StringAsAttemptedJoin:(NSString *)str;

// Performs a shallow copy into other
- (void)copyTo:(OTAccountMetadataClassC *)other;

// Performs a deep merge from other into self
// If set in other, singular values in self are replaced in self
// Singular composite values are recursively merged
// Repeated values from other are appended to repeated values in self
- (void)mergeFrom:(OTAccountMetadataClassC *)other;

OTACCOUNTMETADATACLASSC_FUNCTION BOOL OTAccountMetadataClassCReadFrom(__unsafe_unretained OTAccountMetadataClassC *self, __unsafe_unretained PBDataReader *reader);

@end