// Copyright © Selmo Technology GmbH. All Rights Reserved

using SelmoStudio.Hmi.Server.SelmoHmi.Shared.Component.CustomArgs;

namespace SelmoStudio.Hmi.Server.SelmoHmi.Shared.Component
{
    public class ComponentEventArgs : EventArgs
    {
        public ComponentEventInfo EventInfo { get; private set; }

        public ComponentEventProcessInfo ProcessInfo { get; private set; }

        private ComponentEventArgs()
        {
        }

        public static ComponentEventArgs Create(TextBoxEventArgs e, params ProcessValueHandleInfo[] processValueHandleInfo)
        {
            var args = new ComponentEventArgs()
            {
                EventInfo = e.ToEventInfo(),

                ProcessInfo = new()
                {
                    ProcessValueHandleInfos = processValueHandleInfo.ToList()
                }
            };
            return args;
        }

        public static ComponentEventArgs Create(ButtonEventArgs e, params ProcessValueHandleInfo[] processValueHandleInfo)
        {
            var args = new ComponentEventArgs()
            {
                EventInfo = e.ToEventInfo(),

                ProcessInfo = new()
                {
                    ProcessValueHandleInfos = processValueHandleInfo.ToList()
                }
            };
            return args;
        }

        public static ComponentEventArgs Create(ComponentEventInfo eventInfo, params ProcessValueHandleInfo[] processValueHandleInfo)
        {
            var args = new ComponentEventArgs()
            {
                EventInfo = eventInfo,

                ProcessInfo = new()
                {
                    ProcessValueHandleInfos = processValueHandleInfo.ToList()
                }
            };
            return args;
        }
    }
}