using System.IO;

namespace InABox.Core
{
    [Caption("Attributes")]
    public class CoreAttribute : BaseObject, ISequenceable, IPackable
    {
        public string Name { get; set; } = "";

        public string Value { get; set; } = "";

        public void Pack(BinaryWriter writer)
        {
            writer.Write(Sequence);
            writer.Write(Name);
            writer.Write(Value);
        }

        public void Unpack(BinaryReader reader)
        {
            Sequence = reader.ReadInt64();
            Name = reader.ReadString();
            Value = reader.ReadString();
        }

        [NullEditor]
        public long Sequence { get; set; } = 0;
    }
}