package bx

import (
	"bytes"
	"encoding/binary"
)

type BxCmdClearScreen struct {
	baseBxCmd
}

func NewBxCmdClearScreen(group, cmd byte) BxCmd {
	return BxCmdClearScreen{
		newBaseCmd(CMD_CLEAR_SCREEN.group, CMD_CLEAR_SCREEN.code)}
}

func (cs BxCmdClearScreen) Build() []byte {
	w := bytes.NewBuffer(make([]byte, 1024))
	binary.Write(w, binary.LittleEndian, cs.group)
	binary.Write(w, binary.LittleEndian, cs.cmd)
	binary.Write(w, binary.LittleEndian, cs.ReqResp())
	binary.Write(w, binary.LittleEndian, cs.r0)
	binary.Write(w, binary.LittleEndian, cs.r1)
	return w.Bytes()
}
