
package cn.orionsec.ops.handler.terminal;

import cn.orionsec.kit.lang.able.SafeCloseable;
import cn.orionsec.ops.constant.terminal.TerminalClientOperate;
import cn.orionsec.ops.entity.config.TerminalConnectConfig;
import cn.orionsec.ops.handler.terminal.manager.TerminalManagementHandler;
import cn.orionsec.ops.handler.terminal.watcher.ITerminalWatcherProcessor;

public interface IOperateHandler extends TerminalManagementHandler, SafeCloseable {

    /**
     * 建立连接
     */
    void connect();

    /**
     * 断开连接
     */
    void disconnect();

    /**
     * 处理消息
     *
     * @param operate 操作
     * @param body    body
     * @throws Exception ex
     */
    void handleMessage(TerminalClientOperate operate, String body) throws Exception;

    /**
     * 心跳是否结束
     *
     * @return true结束
     */
    boolean isDown();

    /**
     * 获取token
     *
     * @return token
     */
    String getToken();

    /**
     * 获取终端配置
     *
     * @return 终端配置
     */
    TerminalConnectConfig getHint();

    /**
     * 获取监视器
     *
     * @return processor
     */
    ITerminalWatcherProcessor getWatcher();

}
