// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved.
// See LICENSE.md for full license information.

using Atom.Core.Networking;
using Atom.Core.Networking.Messages;
using Atom.Core.Serialization;

namespace Atom.Core.Local
{
    public class World : ISerializable
    {
        public Client Client { get; set; }
        public string Name { get; set; }
        public byte Number { get; set; }
        public WorldStatus Status { get; set; } = WorldStatus.High;
        public string IPAddress { get; set; }
        public int Port { get; set; }
        public long LastStatusUpdate { get; set; }
        public int Load { get; set; }

        public void Serialize(NetworkMessage msg, SerializeType mode = SerializeType.Default)
        {
            msg.Write(Number);
            msg.Write(Name, 16);
            msg.Write((byte) Status);
        }
    }
}
