package com.f1.ami.relay;
import java.util.Set;
import java.util.concurrent.ThreadFactory;
import com.f1.ami.relay.fh.AmiFH;
import com.f1.ami.relay.plugins.AmiRelayInvokablePlugin;
import com.f1.container.ContainerTools;
//Please note, it's assumed the user is very familiar with the AMI Real-time Messaging API
//
//For the encodedMap(s) parameters:
//
// (A) you can use the com.f1.ami.relay.AmiRelayMapToBytesConverter::toBytes(...) method to conveniently convert a map of params to the expected byte protocol.
// (B) you can implement the following protocol directly, see protocol at bottom of interface definition
public interface AmiRelayIn {
public static int RESPONSE_STATUS_OK = 0;
public static int RESPONSE_STATUS_NOT_FOUND = 1;
public static int RESPONSE_STATUS_ERROR = 2;
//S (status) message
public void onStatus(byte[] encodedMap);
//R (response to execute command) message.
public void onResponse(String I_uniqueId, int S_status, String M_message, String X_executeAmiScript, byte[][] encodedMaps);
//X (exit) message. Clean=true means it was an expected exit, false is unexpected, ex line dropped
public void onLogout(byte[] encodedMap, boolean clean);
//L (login) message
public void onLogin(String O_options, String PL_plugin, byte[] encodedMap);
//C (command definition) message
public void onCommandDef(String I_id, String N_name, int L_level, String W_whereRowLevel, String T_wherePanelLevel, String H_help, String A_formDefinition,
String X_executeAmiScript, int P_priority, String E_enabled, String S_style, String M_multipleSelectMode, String F_fields, byte[] encodedMap, int callbacksMask);
//O (object) message for batching. Set seqNum=-1 for no seqNum. All arrays should have same number of arguments.
public void onObjects(long seqNum, String[] I_ids, String[] T_types, long E_expiresOn, byte[][] encodedMaps);
//O (object) message. Set seqNum=-1 for no seqNum
public void onObject(long seqNum, String I_id, String T_type, long E_expiresOn, byte[] encodedMap);
//D (delete) message. All arrays should have same number of arguments.
public void onObjectDelete(long origSeqnum, String[] I_ids, String T_type, byte[][] encodedMaps);
//when the connection is established, this should be supplied. The optional encoded map will show as parameters on this connection
public void onConnection(byte[] encodedMap);
//when the connection has an unexpected error, this should be supplied. The optional encoded map will show as parameters on this connection. error is user-readable a message
public void onError(byte[] encodedMap, CharSequence error);
//Tools for this AMI instance, internal use
public ContainerTools getTools();
//For creating additional thread
public ThreadFactory getThreadFactory();
//Advanced feature: To start another (typically sub) feed handler.
public void initAndStartFH(AmiFH fh2, String string);
//Advanced feature: get invokable plugins (see ami.relay.invokables property)
public AmiRelayInvokablePlugin getInvokable(String typ);
public Set<String> getInvokableTypes();
}