using FishNet.Object;
using System;
using System.Collections.Generic;
namespace FishNet.Connection
{
    /// 
    /// A container for a connected client used to perform actions on and gather information for the declared client.
    /// 
    public partial class NetworkConnection : IEquatable
    {
        /// 
        /// Level of detail for each NetworkObject.
        /// Since this is called frequently this field is intentionally not an accessor to increase performance.
        /// 
        public Dictionary LevelOfDetails = new Dictionary();
        /// 
        /// Number oftimes this connection may send a forced LOD update.
        /// 
        internal int AllowedForcedLodUpdates;
        /// 
        /// Last tick an LOD was sent.
        /// On client and clientHost this is LocalTick.
        /// On server only this is LastPacketTick for the connection.
        /// 
        internal uint LastLevelOfDetailUpdate;
        /// 
        /// Returns if the client has not sent an LOD update for expectedInterval.
        /// 
        /// 
        internal bool IsLateForLevelOfDetail(uint expectedInterval)
        {
            //Local client is immune since server and client share ticks.
            if (IsLocalClient)
                return false;
            return ((LastPacketTick - LastLevelOfDetailUpdate) > expectedInterval);
        }
        
        /// 
        /// Number of level of detail update infractions for this connection.
        /// 
        internal int LevelOfDetailInfractions;
    }
}