namespace InABox.DigitalMatter
{
    public class DMOperatorField : DMField
    {
        public DMOperatorField()
        {
            Data = new byte[] { };
        }

        public override byte Type => 0x03;

        public byte[] Data { get; set; }

        protected override void DoDecode(IDMReadBuffer buffer)
        {
            int type = buffer.TakeByte();
            Data = buffer.TakeBytes(buffer.BufferSize - 1);
        }

        protected override void DoEncode(IDMWriteBuffer buffer)
        {
            buffer.AddByte(Type);
            buffer.AddBytes(Data);
        }

        public override bool IsValid()
        {
            return true;
        }
    }
}