#import <Foundation/Foundation.h>
#import "FSReason.h"
#import "FSRetryReason.h"
#import "FSRemovalReason.h"

NS_ASSUME_NONNULL_BEGIN

@protocol FSDelegate <NSObject>
@optional

/** This message is sent if FullStory has an internal consistency error.  When this event occurs, no further recording will occur until the application completely exits (i.e., the process is killed, not just that the app is sent to the background) and restarts.

 This message is guaranteed to be sent from the main thread.
 */
- (void)fullstoryDidTerminateWithError:(NSError *)error;

/** This message is sent when FullStory successfully connects to the session server, and begins a session.  Recording is now running, and it is safe to use all FullStory functionality, including +[FS identify], +[FS event], ...

 This message is guaranteed to be sent from the main thread.

 @param sessionUrl A URL that can be used to view the captured session on FullStory.

 */
- (void)fullstoryDidStartSession:(NSString *)sessionUrl;

/** This message is sent when FullStory successfully connects to the session server, and begins a session.  Recording is now running, and it is safe to use all FullStory functionality, including +[FS identify], +[FS event], ...

 This message is guaranteed to be sent from the main thread.

 @param sessionUrl A URL that can be used to view the captured session on FullStory.
 @param sessionId The Fullstory session identifier
 */
- (void)fullstoryDidStartSession:(NSString *)sessionUrl withSessionId:(NSString *)sessionId;

/** This message is sent after FullStory has terminated recording for any reason other than an internal consistency error.  (FullStory terminates recording, among other reasons, when the application is sent to the background, and also upon iOS modal dialogs being presented.)  [FS ...] API calls between the time the previous frame was scanned and this message being sent are not guaranteed to be sent to any session in particular.

 This message is guaranteed to be sent from the main thread.
 */
- (void)fullstoryDidStopSession;


/** This message is sent when the FullStory SDK is disabled.  This may be due to an incompatible device or OS version, or because FullStory was not properly instrumented (e.g., missing configuration).

 The session will not begin at a future point.

 This message is guaranteed to be sent from the main thread.

 Because the message can be fired very early in in the app's lifecycle, it will be buffered until a delegate is set.

 @param reason An @c FSReason object with a numeric reason code and a message describing the reason Fullstory was disabled.
 */
- (void)fullstoryDidDisable:(FSReason *)reason;


/** This message is sent when the FullStory session is disabled.  This may be due to a connectivity issue or the org running out of sessions.

 The session will be retried the next time the app is foregrounded, and it may begin at that point.

 This message is guaranteed to be sent from the main thread.

 @param reason An @c FSReason object with a numeric reason code and a message describing the reason Fullstory was disabled.
 */
- (void)fullstoryDidDisableSession:(FSReason *)reason;


/** This message is sent when the Fullstory SDK will retry a request to its backend servers.

 When this message is sent, the delay has already elapsed and the retry is being sent concurrently.

 This message is guaranteed to be sent from the main thread.

 @param reason  An @c FSRetryReason object with details about the request and the reason it is being retried
 */
- (void)fullstoryWillRetry:(FSRetryReason *)reason;

/** This message is sent when the Fullstory SDK removes an item from the upload queue and will not continue trying to upload it.

 @param reason  An @c FSRemovalReason object with details about the request and the reason it is being removed
 */
- (void)fullstoryDidRemove:(FSRemovalReason *)reason;
@end

NS_ASSUME_NONNULL_END
