package com.its.vds.xnettcp.vds.protocol.impl;

import com.its.vds.dto.TbVdsCtlrDto;
import com.its.vds.xnettcp.vds.protocol.VdsFramePacket;
import com.its.vds.xnettcp.vds.protocol.VdsReqFramePacket;
import com.its.vds.xnettcp.vds.protocol.enums.eVdsOpCode;
import com.its.vds.xnettcp.vds.protocol.impl.andong.VdsAndongReqFramePacket;
import lombok.extern.slf4j.Slf4j;

import java.nio.ByteBuffer;

/**
 * VDS Status Reset 요청
 */
@Slf4j
public class VdsReqStatusReset extends VdsReqFramePacket {

    private final VdsFramePacket framePacket;

    public VdsReqStatusReset(TbVdsCtlrDto vdsObj) {
        this.opCode = eVdsOpCode.OP_VDS_STATUS_RESET;
        byte opCode = (byte)this.opCode.getValue();
        this.packetNmbr = vdsObj.getSeqNext();
        this.framePacket = new VdsAndongReqFramePacket(vdsObj.getGroupNo(), vdsObj.getVdsCtlrNmbr().intValue(), this.packetNmbr, opCode);
    }

    @Override
    public ByteBuffer getByteBuffer() {
        return this.framePacket.getByteBuffer();
    }

}
