//
//  NeuraAuthenticationStateDelegate.h
//  NeuraSDK
//
//  Created by Neura on 01/08/2017.
//  Copyright © 2017 Neura. All rights reserved.
//
#import <Foundation/Foundation.h>

/**
 NeuraAuthState - The possible authentication flow states.
*/
typedef NS_ENUM(NSUInteger, NeuraAuthState) {
    /** NeuraAuthStateNotAuthenticated: Not authenticated */
    NeuraAuthStateNotAuthenticated,
    
    /** NeuraAuthStateFailed: Authentication failed.
     Required tokens are missing and an authentication attempt is required in order to enable Neura SDK.
     */
    NeuraAuthStateFailed,
    
    /** NeuraAuthStateAuthenticatedAnonymously: Finished anonymous authentication and received tokens.
        It is possible to stay in this state, even if tokens expired and required to be refreshed in the background.
     */
    NeuraAuthStateAuthenticatedAnonymously,

    /** NeuraAuthStateAuthenticated: Finished authentication and received tokens.
        It is possible to stay in this state, even if tokens expired and required to be refreshed in the background.
     */
    NeuraAuthStateAuthenticated,
    
    /** NeuraAuthStateRequestingAuthenticationFromServer: still processing the auth request sent to the server.
        Calling authenticate while in this state will fail immediately */
    NeuraAuthStateRequestingAuthenticationFromServer
};

@protocol NeuraAuthenticationDelegate

@optional
/**
 neuraAuthenticationStateChanged is called whenever authenticationState changed.

 @param newState The new authentication state of the SDK.
 */
- (void)neuraAuthenticationStateChanged:(NeuraAuthState)newState;

/**
 neuraAccessTokenChanged is called whenever the value of the access token has changed.
 This will be called also when the access token is deleted (and nil will be passed).

 @param newAccessToken The new access token string.
 */
- (void)neuraAccessTokenChanged:(NSString * _Nullable)newAccessToken;

@end
