#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
using System.IO;

namespace Volpe.Cafe.Logging
{
    /// <summary>
    /// Defines an empty logger that suppresses all logging capability.
    /// </summary>
    [Serializable]
    public sealed class EmptyLogger : ILogger
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EmptyLogger"/> class.
        /// </summary>
        public EmptyLogger()
        {
            this.IsDisposed = false;
        }

        //----- properties -----
        public bool IsDisposed { get; private set; }

        object ILogger.SyncRoot { get; } = new object();

        LogLevel ILogger.LogLevel => LogLevel.Disabled;

        string ILogger.LogPath => null;
        string ILogger.DebugLogPath => null;

        TextWriter ILogger.Summary => null;
        TextWriter ILogger.Warnings => null;
        TextWriter ILogger.Errors => null;

        //----- methods -----
        public void Close()
        {
            this.Dispose();
        }
        public void Dispose()
        {
            this.IsDisposed = true;
        }

        void ILogger.InitCfLogs(int logCount, int bufferCount)
        {
            this.ThrowIfDisposed();
        }
        void ILogger.FlushCfLogs()
        {
            this.ThrowIfDisposed();
        }
        BufferedComplianceWriter ILogger.GetCfLog(int index)
        {
            this.ThrowIfDisposed();
            return null;
        }

        void ILogger.InitCreditTradingLogs(int logCount)
        {
            this.ThrowIfDisposed();
        }
        LogFileWriter ILogger.GetCreditTradingLog(int index)
        {
            this.ThrowIfDisposed();
            return null;
        }

        LogFileWriter ILogger.GetCustomLog(string fileName, string[] headers, bool persistent)
        {
            this.ThrowIfDisposed();
            return null;
        }
        LogFileWriter ILogger.GetDebugLog(string fileName, string[] headers, bool persistent)
        {
            this.ThrowIfDisposed();
            return null;
        }

        void ILogger.LogError(string value)
        {
            this.ThrowIfDisposed();
        }
        void ILogger.LogSummary(string value)
        {
            this.ThrowIfDisposed();
        }
        void ILogger.LogWarning(string value)
        {
            this.ThrowIfDisposed();
        }

        void ILogger.SafeLogError(string value)
        {
            this.ThrowIfDisposed();
        }
        void ILogger.SafeLogSummary(string value)
        {
            this.ThrowIfDisposed();
        }
        void ILogger.SafeLogWarning(string value)
        {
            this.ThrowIfDisposed();
        }

        private void ThrowIfDisposed()
        {
            if (this.IsDisposed) {
                ThrowHelper.LoggerDisposed();
            }
        }

    }
}
