using WCS.Core;
using ILog = WCS.Core.ILog;

namespace WCS.WorkEngineering.Worlds.Logs
{
    /// <summary>
    ///  带KEY的日志
    /// </summary>
    public class KeyLog
    {
        /// <summary>
        ///  日志KEY
        /// </summary>
        public Channel Channel { get; set; } = null!;

        /// <summary>
        ///  日志信息
        /// </summary>
        public LogInfo Log { get; set; }

        /// <summary>
        ///  日志时间
        /// </summary>

        public DateTime Time { get; set; } = DateTime.Now;

        /// <summary>
        ///  日志信息
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return $"类型:{Log.Type.Description()},级别:{Log.Level.Description()},上传类型:{Log.LogUpLoad.Description()},内容:{Log.Message}";
        }
    }

    /// <summary>
    ///  日志信息
    /// </summary>
    public struct LogInfo : ILog
    {
        /// <summary>
        ///  日志信息
        /// </summary>
        public ErrorTypeEnum Type { get; set; }

        /// <summary>
        /// 日志级别
        /// </summary>
        public LogLevelEnum Level { get; set; }

        /// <summary>
        ///  日志上传类型
        /// </summary>
        public LogUpLoadEnum LogUpLoad { get; set; }

        /// <summary>
        /// 日志内容
        /// </summary>
        public string Message { get; set; }
    }
}
