namespace Quadarax.Foundation.Core.QMonitor
{
    public class QMonReceiverConfiguration : QMonHostConfiguration
    {
        public Uri SourceUriGeneral { get; set; }
        public Uri SourceUriData { get; set; }
        public TimeSpan GeneralReceiverInterval { get; set; }


        public DataCacheConfiguration DataCache { get; set; } = new();

        public static QMonReceiverConfiguration CreateDefault()
        {
            return new QMonReceiverConfiguration()
            {
                Enabled = true,
                SourceUriGeneral = new Uri(Constants.DefaultUriGeneral),
                SourceUriData = new Uri(Constants.DefaultUriData),
                GeneralReceiverInterval = TimeSpan.FromSeconds(5),
                DataCache = new DataCacheConfiguration()
                {
                    Path = "%AppData%\\.qmon",
                    RecordRetentionTimeSpan = TimeSpan.FromHours(5),
                    FlushCacheInterval = TimeSpan.FromSeconds(5)
                }
            };
        }

        public class DataCacheConfiguration
        {
            public string Path { get; set; }
            public TimeSpan RecordRetentionTimeSpan { get; set; }

            public TimeSpan FlushCacheInterval { get; set; }
        }
    }
}