package com.ruoyi.device.mqtt.handler.encoder.tax;

import com.ruoyi.device.mqtt.annotation.ProducerHandler;
import com.ruoyi.device.mqtt.domain.encoder.tax.CiphertextDataDown;
import com.ruoyi.device.mqtt.enums.MsgTypeEnum;
import com.ruoyi.device.mqtt.enums.QosEnum;
import com.ruoyi.device.mqtt.handler.encoder.AbstractEncoder;
import io.netty.buffer.ByteBuf;

/**
 * 报税口密文数据 解密下发编码
 */
@ProducerHandler(msgType = MsgTypeEnum.CIPHERTEXT_DATA_DECRYPT_DOWN)
public class CiphertextDataDecryptEncoder extends AbstractEncoder<CiphertextDataDown>
{
    @Override
    protected void encode(CiphertextDataDown request, ByteBuf body)
    {
        body.writeBytes(request.getCiphertextData());
    }

    @Override
    protected String topic(CiphertextDataDown request)
    {
        return generateTopic(request);
    }

    @Override
    protected MsgTypeEnum msgType()
    {
        return MsgTypeEnum.CIPHERTEXT_DATA_DECRYPT_DOWN;
    }

    @Override
    protected QosEnum qos()
    {
        return QosEnum.QoS2;
    }

    @Override
    protected boolean retain()
    {
        return false;
    }
}
