package replicant.spy;

import arez.spy.SerializableEvent;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nonnull;
import org.realityforge.replicant.client.transport.DataLoadStatus;

/**
 * Notification when an DataLoader generated an error processing a message from the datasource.
 */
public final class DataLoaderMessageProcessEvent
  implements SerializableEvent
{
  @Nonnull
  private final Class<?> _systemType;
  @Nonnull
  private final DataLoadStatus _dataLoadStatus;

  public DataLoaderMessageProcessEvent( @Nonnull final Class<?> systemType,
                                        @Nonnull final DataLoadStatus dataLoadStatus )
  {
    _systemType = Objects.requireNonNull( systemType );
    _dataLoadStatus = Objects.requireNonNull( dataLoadStatus );
  }

  @Nonnull
  public Class<?> getSystemType()
  {
    return _systemType;
  }

  @Nonnull
  public DataLoadStatus getDataLoadStatus()
  {
    return _dataLoadStatus;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void toMap( @Nonnull final Map<String, Object> map )
  {
    map.put( "type", "DataLoader.MessageProcess" );
    map.put( "systemType", getSystemType().getSimpleName() );
  }
}

@@ -1177,18 +1177,571 @@
 leName() );%0A
+    final DataLoadStatus status = getDataLoadStatus();%0A    map.put( %22sequence%22, status.getSequence() );%0A    map.put( %22requestId%22, status.getRequestID() );%0A    map.put( %22channelAddCount%22, status.getChannelAddCount() );%0A    map.put( %22channelRemoveCount%22, status.getChannelRemoveCount() );%0A    map.put( %22channelUpdateCount%22, status.getChannelUpdateCount() );%0A    map.put( %22entityUpdateCount%22, status.getEntityUpdateCount() );%0A    map.put( %22entityRemoveCount%22, status.getEntityRemoveCount() );%0A    map.put( %22entityLinkCount%22, status.getEntityLinkCount() );%0A
   %7D%0A%7D%0A

Add aditional information to serialization