using JiShe.CollectBus.Protocol.Interfaces;
using Microsoft.Extensions.Logging;

namespace JiShe.CollectBus.Protocol.T37612012.Appendix
{
    /// <summary>
    /// Appendix_02800002
    /// </summary>
    public class Appendix_02800002 : IAnalysisStrategy<List<string>>
    {
        private readonly ILogger<Appendix_02800002> _logger;

        public Appendix_02800002(ILogger<Appendix_02800002> logger)
        {
            _logger = logger;
        }

        public Task<bool> ExecuteAsync(List<string> data, Action<dynamic>? result = null)
        {
            try
            {
                if (data.Count != 2)
                    return null;
                var value = string.Join(".", data);
                var values= new List<string>() { "电网频率", "10_97", "1", value };
                result?.Invoke(values);
                return Task.FromResult(true);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Appendix_02800002解析失败:{ex.Message}");
                return Task.FromResult(false);
            }
        }
    }
}
