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

namespace JiShe.CollectBus.Protocol.T37612012.Appendix
{
    /// <summary>
    /// 年时区数 p≤14
    /// </summary>
    public class Appendix_04000201 : IAnalysisStrategy<List<string>>
    {
        private int valueByteCount = 1;
        private readonly ILogger<Appendix_04000201> _logger;

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

        public async Task<bool> ExecuteAsync(List<string> data, Action<dynamic>? result = null)
        {
            List<string> values = new List<string>();
            values.Insert(0, "10_94");
            values.Insert(0, "年时区数");
            values.Add((data.Count / valueByteCount).ToString());//值总数
            foreach (var item in data)
            {
                values.Add(item.HexToDec().ToString());
            }
            result?.Invoke(values);
            return await Task.FromResult(true);
        }
    }
}
