/*
 * tcp_model.h
 *
 *  Created on: 2022年10月6日
 *      Author: Allen
 */

#ifndef JNI_NET_TCP_MODEL_H_
#define JNI_NET_TCP_MODEL_H_

#include <string>
#include "net.h"
#include "json/json.h"

class TcpType{
public:
	inline static std::string OTHER = "OTHER";
	inline static std::string VOICE = "VOICE";
	inline static std::string SOS = "SOS";
	inline static std::string REINFORCE = "REINFORCE";
	inline static std::string EVENT = "EVENT";
	inline static std::string DEVICE = "DEVICE";
	inline static std::string DATA = "DATA";
	inline static std::string TIME = "TIME";
	inline static std::string S433 = "S433";
};

class VoiceAction {
public:
	inline static std::string CALL = "CALL";
	inline static std::string ACCEPT = "ACCEPT";
	inline static std::string REJECT = "REJECT";
	inline static std::string CALLING = "CALLING";
	inline static std::string TRANSFER = "TRANSFER";
	inline static std::string HANDOFF = "HANDOFF";
	inline static std::string CANCEL = "CANCEL";
	inline static std::string SUCCESS = "SUCCESS";
	inline static std::string FAILED = "FAILED";
};

class SosAction {
public:
	inline static std::string CALL = "CALL";
	inline static std::string SOS_CALL = "SOS_CALL";
	inline static std::string CANCEL = "CANCEL";
	inline static std::string CANCELED = "CANCELED";
};

class EventAction {
public:
	inline static std::string KEY_CLICK = "KEY_CLICK";		// 按键事件
	inline static std::string RESPONSE = "RESPONSE";		// 响应
	inline static std::string RESPONSED = "RESPONSED";
	inline static std::string RECEIVED = "RECEIVED";
	inline static std::string CANCEL = "CANCEL";
	inline static std::string CANCEL_CONFIRM = "CANCEL_CONFIRM";
	inline static std::string COMPLETED = "COMPLETED";
	inline static std::string NO_TARGET = "NO_TARGET";
	inline static std::string NO_MATCH = "NO_MATCH";
};

class DeviceAction {
public:
	inline static std::string RESTART = "RESTART";
	inline static std::string CONNECT = "CONNECT";
	inline static std::string APP_UPDATE = "APP_UPDATE";
	inline static std::string DEVICE_REFRESH = "DEVICE_REFRESH";
	inline static std::string SERVER_CHANGE = "SERVER_CHANGE";
};

class DataAction {
public:
	inline static std::string REFRESH = "REFRESH";
};

class ReinforceAction {
public:
	inline static std::string CALL="CALL";
	inline static std::string RESPONSED="RESPONSED";
};

class TimeAction {
public:
	inline static std::string SYNC = "SYNC";
};

class S433Action {
public:
	inline static std::string CALL = "CALL";
	inline static std::string SOS_CALL = "SOS_CALL";
	inline static std::string CANCEL = "CANCEL";
	inline static std::string SYNC_TIME = "SYNC_TIME";
	inline static std::string DATA = "DATA";
	inline static std::string EXIST = "EXIST";
	inline static std::string ACK = "ACK";
	inline static std::string SELECT_LORA = "SELECT_LORA";
	inline static std::string ADD_LORA = "ADD_LORA";
	inline static std::string DELETE_LORA = "DELETE_LORA";
	inline static std::string DELETE_ALL_LORA = "DELETE_ALL_LORA";
	inline static std::string NO_MATCH = "NO_MATCH";
};

class TcpAction{
	VoiceAction voiceAction;
};

struct TcpModel{
	std::string tid;
	std::string type;
	std::string action;
	int from_id = 0;
	int to_id = 0;
	std::string data = "";
	Json::Value json = NULL;
};

std::string getTcpModelString(TcpModel model);

TcpModel getTcpModel(byte* inBytes);

#endif /* JNI_NET_TCP_MODEL_H_ */
