using Edge.Core.Parser;
using Edge.Core.Parser.BinaryParser.MessageEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Edge.Core.Processor
{

    public interface IIncoming<TMessage> where TMessage : MessageBase
    {
        event EventHandler OnMessageIncoming;

        /// <summary>
        /// indicates it's been a while that have NOT received any messages incoming from communicator.
        /// if the incoming has never received a message from the begining(happened at the application just started),
        ///     then this event will NOT fired.
        /// </summary>
        event EventHandler OnLongTimeNoSeeMessage;

        /// <summary>
        /// by ms, for control firing the event: OnLongTimeNoSeeMessageIncoming which indicates not received any msg for period time of this value specified.
        /// 0 will disable the feature.
        /// </summary>
        int LongTimeNoSeeMessageTimeout { get; set; }
        /// <summary>
        /// Gets or sets if should notifiy the IHandler a new message is incoming.
        /// this is a hook for intercept a new message to IHanlder.
        /// </summary>
        bool DisablePropagate { get; set; }
        TMessage Message { get; set; }
    }
}
