package de.dhbwstuttgart.server.packet;

import com.fasterxml.jackson.annotation.JsonIgnore;
import de.dhbwstuttgart.server.SocketFuture;
import de.dhbwstuttgart.server.SocketServer;
import org.java_websocket.WebSocket;

/**
 * A packet that will be sent to the server. Use <code>Void</code> Sub-Interface for packets without response
 *
 * @param <T>   The response packet that will fulfill the future.
 */
public interface IClientToServerPacket<T extends IServerToClientPacket> extends IPacket {

  @JsonIgnore
  void onHandle(WebSocket webSocket, SocketServer socketServer);

  @JsonIgnore
  SocketFuture<T> getFuture();

  /**
   * Special case, where the packet will remain unanswered by the server
   */
  interface Void extends IClientToServerPacket<IServerToClientPacket> {}
}

