package com.lutao.cloud.iot.mqtt.core.server;

import com.lutao.cloud.iot.mqtt.codec.*;
import org.tio.core.ChannelContext;

/**
 * mqtt broker 处理器
 *

 */
public interface MqttServerProcessor {

    /**
     * 处理链接
     *
     * @param context ChannelContext
     * @param message MqttConnectMessage
     */
    void processConnect(ChannelContext context, MqttConnectMessage message);

    /**
     * Publish
     *
     * @param context ChannelContext
     * @param message MqttPublishMessage
     */
    void processPublish(ChannelContext context, MqttPublishMessage message);

    /**
     * PubAck
     *
     * @param context        ChannelContext
     * @param variableHeader MqttMessageIdVariableHeader
     */
    void processPubAck(ChannelContext context, MqttMessageIdVariableHeader variableHeader);

    /**
     * PubRec
     *
     * @param context        ChannelContext
     * @param variableHeader MqttMessageIdVariableHeader
     */
    void processPubRec(ChannelContext context, MqttMessageIdVariableHeader variableHeader);

    /**
     * PubRel
     *
     * @param context        ChannelContext
     * @param variableHeader MqttMessageIdVariableHeader
     */
    void processPubRel(ChannelContext context, MqttMessageIdVariableHeader variableHeader);

    /**
     * PubComp
     *
     * @param context        ChannelContext
     * @param variableHeader MqttMessageIdVariableHeader
     */
    void processPubComp(ChannelContext context, MqttMessageIdVariableHeader variableHeader);

    /**
     * 监听
     *
     * @param context ChannelContext
     * @param message MqttSubscribeMessage
     */
    void processSubscribe(ChannelContext context, MqttSubscribeMessage message);

    /**
     * 取消监听
     *
     * @param context ChannelContext
     * @param message MqttUnsubscribeMessage
     */
    void processUnSubscribe(ChannelContext context, MqttUnsubscribeMessage message);

    /**
     * ping 消息处理
     *
     * @param context ChannelContext
     */
    void processPingReq(ChannelContext context);

    /**
     * 断开连接
     *
     * @param context ChannelContext
     */
    void processDisConnect(ChannelContext context);

}
