using System;

namespace EonaCat.Logger.EonaCatCoreLogger.Internal
{
    // This file is part of the EonaCat project(s) which is released under the Apache License.
    // See the LICENSE file or go to https://EonaCat.com/License for full license details.

    public class BatchingLoggerOptions
    {
        private int _batchSize = 0;
        private TimeSpan _flushPeriod = TimeSpan.FromMilliseconds(100);

        /// <summary>
        /// Gets or sets the period after which logs will be flushed to the store.
        /// </summary>
        public TimeSpan FlushPeriod
        {
            get => _flushPeriod;

            set
            {
                if (value <= TimeSpan.Zero)
                {
                    throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(FlushPeriod)} must be positive.");
                }
                _flushPeriod = value;
            }
        }

        /// <summary>
        /// Gets or sets a maximum number of events to include in a single batch or less than 1 for no limit.
        /// </summary>
        public int BatchSize
        {
            get => _batchSize;

            set
            {
                _batchSize = value;
            }
        }

        /// <summary>
        /// Gets or sets value indicating if logger accepts and queues writes.
        /// </summary>
        public bool IsEnabled { get; set; }
    }
}