#import <Foundation/Foundation.h>

@class ZSMError;
@class NetworkClient;

NS_ASSUME_NONNULL_BEGIN

@interface RelyingParty : NSObject

@property (nonatomic, strong, nullable) NSString *customerDefinedIdentifier;
@property (nonatomic, strong, nullable) NSString *credentialID;
@property (nonatomic, strong) NSDictionary *publicKey;
@property (nonatomic, strong, nullable) NSString *identityID;
@property (nonatomic, strong, readonly) NetworkClient *networkClient;

// Backward compatibility - access to base URL
@property (nonatomic, strong, readonly) NSURL *host;

- (instancetype)initWithHost:(NSURL *)host apiKey:(NSUUID *)apiKey applicationId:(NSUUID *)applicationId;

// **Authentication Start**
- (void)authenticationStart:(NSString *)userId credentialId:(NSString *)credentialId
                 completion:(void (^)(NSDictionary * _Nullable, ZSMError * _Nullable))completion;

// **Create Identity & Start Registration**
- (void)createIdentityThenRegistrationStart:(NSString *)userId
                                 completion:(void (^)(NSDictionary * _Nullable, ZSMError * _Nullable))completion;

// **Complete Registration & Start Authentication**
- (void)registrationFinishAuthenticationStart:(NSString *)userId
                                   credential:(NSDictionary *)credential
                                   completion:(void (^)(NSDictionary * _Nullable, ZSMError * _Nullable))completion;

// **Unbind current credential
- (void)unbind;

// **Get and Set Identity ID**
- (NSString * _Nullable)getIdentityID;
- (void)setIdentityID:(NSString * _Nullable)identityID;

// **Identity Mapping Methods**
- (void)storeIdentityMapping:(NSString *)userId identityId:(NSString *)identityId;
- (NSString *)lookupIdentityMapping:(NSString *)userId;
- (NSString *)getConsumerIdForMPC:(NSString *)userId;

// **Networking Methods** 
- (void)makePostRequest:(NSString *)endpoint
                   body:(NSDictionary *)body
                traceId:(NSString *)traceId
             completion:(void (^)(NSDictionary * _Nullable response, ZSMError * _Nullable error))completion;

@end

NS_ASSUME_NONNULL_END
