namespace Quadarax.Foundation.Core.QMonitor.Interfaces
{
    public delegate void ReceiverHandlerStateChanged(IReceiverHandler sender, ReceiverHandlerStateEnum state);
    public delegate void ReceiverHandlerDataChanged(IReceiverHandler sender, MonData newData);
    public interface IReceiverHandler : IDisposable
    {
        string InstanceIdentifier { get;  }
        MonItemGeneral Descriptor { get; }
        ReceiverHandlerStateEnum State { get; }
        bool IsLiveBroadcast { get; }
        DateTime? Timestamp { get; }
        TimeSpan RefreshInterval { get; set; }
        MonData[]? CurrentData { get; }

        event ReceiverHandlerStateChanged? ReceiverHandlerStateChanged;
        event ReceiverHandlerDataChanged? ReceiverHandlerDataChanged;

        void Play(bool isLive);
        void Stop();
        void Rewind(TimeSpan? duration = null, bool isBackward = false);
        void RewindToNextChange();
        void RewindToPreviousChange();
        void Record();
        

        DateTime? GetFirstAvailableDataTimestamp();
    }

    public enum ReceiverHandlerStateEnum
    {
        Play,
        Stop,
        Rewind,
        Record
    }
}
