namespace InABox.DigitalMatter
{
    public class DMTripDataField : DMField
    {
        public override byte Type => 0x0F;

        public byte Reason { get; set; }
        public ushort Trimming { get; set; }

        protected override void DoDecode(IDMReadBuffer buffer)
        {
            Reason = buffer.TakeByte();
            Trimming = buffer.TakeUInt16();
        }

        protected override void DoEncode(IDMWriteBuffer buffer)
        {
            buffer.AddByte(Reason);
            buffer.AddUInt16(Trimming);
        }

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