// Copyright © Selmo Technology GmbH. All Rights Reserved

using Novus.Connectivity.Common;

namespace SelmoStudio.Hmi.Server.SelmoHmi.Shared.Mappers
{
    public static class StatusToIconMapper
    {
        public static List<string> MapFromProcessValues(List<IProcessValueInfo> infos)
        {
            List<string> mappedList = new List<string>();
            foreach (var info in infos)
            {
                var mapped = Map(info);
                if (mapped != "")
                    mappedList.Add(mapped);
            }
            return mappedList;
        }

        private static string Map(IProcessValueInfo info)
        {
            //HWZone Values
            if (info.Address.FullPath.Contains("xAnySeqEocReached"))
                return "eocIcon iconSizeSmall iconDark";
            if (info.Address.FullPath.Contains("xAnySeqSingleStep"))
                return "stepOverIcon iconSizeSmall iconDark";
            if (info.Address.FullPath.Contains("xAnySeqGhostModeOn"))
                return "ghostIcon iconSizeSmall iconDark";
            if (info.Address.FullPath.Contains("xAnySeqTimeOut"))
                return "timerOutlineIcon iconSizeSmall iconDark";

            //Sequence Values
            if (info.Address.FullPath.Contains("xSeqGhostModeReleased")) 
                return "ghostIcon iconSizeSmall iconDark";
            if (info.Address.FullPath.Contains("xSeqEndOfCycleReached"))
                return "eocIcon iconSizeSmall iconDark";
            if (info.Address.FullPath.Contains("xHmiPbSingleStepOn"))
                return "stepOverIcon iconSizeSmall iconDark";
            if (info.Address.FullPath.Contains("xHmiMsgStepTimeoutStored"))
                return "timerOutlineIcon iconSizeSmall iconDark";
            return "";
        }
    }
}