package org.realityforge.replicant.client.transport;

import javax.annotation.Nonnull;
import replicant.ChannelAddress;

public interface DataLoaderListener
{
  /**
   * Invoked to fire an event when disconnect has completed.
   */
  void onDisconnect( @Nonnull DataLoaderService service );

  /**
   * Invoked to fire an event when failed to connect.
   */
  void onInvalidDisconnect( @Nonnull DataLoaderService service, @Nonnull Throwable throwable );

  /**
   * Invoked to fire an event when disconnect has completed.
   */
  void onConnect( @Nonnull DataLoaderService service );

  /**
   * Invoked to fire an event when failed to connect.
   */
  void onInvalidConnect( @Nonnull DataLoaderService service, @Nonnull Throwable throwable );

  /**
   * Called when a data load has completed.
   */
  void onDataLoadComplete( @Nonnull DataLoaderService service, @Nonnull DataLoadStatus status );

  /**
   * Called when a data load has resulted in a failure.
   */
  void onDataLoadFailure( @Nonnull DataLoaderService service, @Nonnull Throwable throwable );

  /**
   * Attempted to retrieve data from backend and failed.
   */
  void onPollFailure( @Nonnull DataLoaderService service, @Nonnull Throwable throwable );

  void onSubscribeStarted( @Nonnull DataLoaderService service, @Nonnull ChannelAddress descriptor );

  void onSubscribeCompleted( @Nonnull DataLoaderService service, @Nonnull ChannelAddress descriptor );

  void onSubscribeFailed( @Nonnull DataLoaderService service,
                          @Nonnull ChannelAddress descriptor,
                          @Nonnull Throwable throwable );

  void onUnsubscribeStarted( @Nonnull DataLoaderService service, @Nonnull ChannelAddress descriptor );

  void onUnsubscribeCompleted( @Nonnull DataLoaderService service, @Nonnull ChannelAddress descriptor );

  void onUnsubscribeFailed( @Nonnull DataLoaderService service,
                            @Nonnull ChannelAddress descriptor,
                            @Nonnull Throwable throwable );

  void onSubscriptionUpdateStarted( @Nonnull DataLoaderService service, @Nonnull ChannelAddress descriptor );

  void onSubscriptionUpdateCompleted( @Nonnull DataLoaderService service, @Nonnull ChannelAddress descriptor );

  void onSubscriptionUpdateFailed( @Nonnull DataLoaderService service,
                                   @Nonnull ChannelAddress descriptor,
                                   @Nonnull Throwable throwable );
}

@@ -430,33 +430,29 @@
 l Throwable 
-throwable
+error
  );%0A%0A  /**%0A 
@@ -716,33 +716,29 @@
 l Throwable 
-throwable
+error
  );%0A%0A  /**%0A 
@@ -1029,33 +1029,29 @@
 l Throwable 
-throwable
+error
  );%0A%0A  /**%0A 
@@ -1185,33 +1185,29 @@
 l Throwable 
-throwable
+error
  );%0A%0A  void 
@@ -1282,34 +1282,31 @@
 nnelAddress 
-descriptor
+address
  );%0A%0A  void 
@@ -1383,34 +1383,31 @@
 nnelAddress 
-descriptor
+address
  );%0A%0A  void 
@@ -1507,34 +1507,31 @@
 nnelAddress 
-descriptor
+address
 ,%0A          
@@ -1561,33 +1561,29 @@
 l Throwable 
-throwable
+error
  );%0A%0A  void 
@@ -1660,34 +1660,31 @@
 nnelAddress 
-descriptor
+address
  );%0A%0A  void 
@@ -1763,34 +1763,31 @@
 nnelAddress 
-descriptor
+address
  );%0A%0A  void 
@@ -1891,34 +1891,31 @@
 nnelAddress 
-descriptor
+address
 ,%0A          
@@ -1947,33 +1947,29 @@
 l Throwable 
-throwable
+error
  );%0A%0A  void 
@@ -2053,34 +2053,31 @@
 nnelAddress 
-descriptor
+address
  );%0A%0A  void 
@@ -2167,26 +2167,23 @@
 Address 
-descriptor
+address
  );%0A%0A  v
@@ -2313,18 +2313,15 @@
 ess 
-descriptor
+address
 ,%0A  
@@ -2376,17 +2376,13 @@
 ble 
-throwable
+error
  );%0A

Rename parameters as appropriate