// time for refresh token
export const SECONDS_BEFORE_EXPIRATION = 600;

// Internal SDK events, subscribed by SyncManager and PushManager
/**
 * emitted on SSE and Authenticate non-recoverable errors, STREAMING_DISABLED control notification and authentication with pushEnabled false
 * triggers `handleNonRetryableError` call
 */
export const PUSH_NON_RETRYABLE_ERROR = 'PUSH_NON_RETRYABLE_ERROR';
/**
 * emitted on SSE and Authenticate recoverable errors
 * triggers `handleRetryableError` call
 */
export const PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR';
/**
 * emitted on STREAMING_RESUMED control notification, OCCUPANCY different than 0, and SSE onopen event
 * triggers `stopPollingAndSyncAll` call
 */
export const PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';

/**
 * emitted on STREAMING_PAUSED control notification, OCCUPANCY equal to 0, PUSH_NON_RETRYABLE_ERROR and PUSH_RETRYABLE_ERROR events.
 * triggers `startPolling` and `stopWorkers` calls
 */
export const PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';

// Update-type push notifications, handled by NotificationProcessor
export const MEMBERSHIPS_MS_UPDATE = 'MEMBERSHIPS_MS_UPDATE';
export const MEMBERSHIPS_LS_UPDATE = 'MEMBERSHIPS_LS_UPDATE';
export const SEGMENT_UPDATE = 'SEGMENT_UPDATE';
export const SPLIT_KILL = 'SPLIT_KILL';
export const SPLIT_UPDATE = 'SPLIT_UPDATE';
export const RB_SEGMENT_UPDATE = 'RB_SEGMENT_UPDATE';

// Control-type push notifications, handled by NotificationKeeper
export const CONTROL = 'CONTROL';
export const OCCUPANCY = 'OCCUPANCY';

export enum ControlType {
  STREAMING_DISABLED = 'STREAMING_DISABLED',
  STREAMING_PAUSED = 'STREAMING_PAUSED',
  STREAMING_RESUMED = 'STREAMING_RESUMED',
  STREAMING_RESET = 'STREAMING_RESET',
}
