package com.wdkl.ncs.android.middleware.tcp.channel;

import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel;
import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction;
import com.wdkl.ncs.android.middleware.tcp.enums.TcpType;

import java.util.HashMap;
import java.util.Map;

public class EventUtil {
    //分机发送按键事件无需toId
    public static TcpModel eventKeyClick(Integer fromId, Integer keyId){
        Map map = new HashMap();
        map.put("id", keyId);

        TcpModel tcpModel = new TcpModel();
        tcpModel.setType(TcpType.EVENT);
        tcpModel.setAction(TcpAction.EventAction.KEY_CLICK);
        tcpModel.setFromId(fromId);
        tcpModel.setData(map);
        return tcpModel;
    }

    public static TcpModel eventResponse(Integer fromId, Integer toId, Integer eventId){
        TcpModel tcpModel = new TcpModel();
        tcpModel.setType(TcpType.EVENT);
        tcpModel.setAction(TcpAction.EventAction.RESPONSE);
        tcpModel.setFromId(fromId);
        tcpModel.setToId(toId);
        tcpModel.setData(eventId);
        return tcpModel;
    }
}
