using System;
using System.Collections.Generic;
using System.Text;

namespace StateHasChanged2.Utils
{
    public static partial class Utils
    {
        /// <summary>
        /// Definisce il metodo di callback dell'evento Progress
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public delegate void ProgressEventHandler(object sender, ProgressEventArgs e);
        public delegate void EventHandler(object sender);
        /// <summary>
        /// Gestisce il parametro dell'evento Progress
        /// </summary>
        public class ProgressEventArgs : EventArgs
        {
            #region Enums
            /// <summary>
            /// Tipo di azione
            /// </summary>
            public enum ActionContextType
            {
                /// <summary>
                /// Nessuna
                /// </summary>
                None = 0,
                BackgroundServiceTask = 1,
                SendMail = 2
            }

            public enum BackgroundServiceTaskAction
            {
                None = 0,
                GetDomains = 1,
                ProcessDomain = 2,
                GetUsers = 3,
                ProcessUser = 4,
                GetCompanies = 5,
                ProcessCompany = 6
            }
            #endregion

            #region Proprietà
            /// <summary>
            /// Step corrente
            /// </summary>
            public int CurrentStep { get; set; }
            /// <summary>
            /// Numero totale di step
            /// </summary>
            public int StepCount { get; set; }
            /// <summary>
            /// Contesto dell'azione
            /// </summary>
            public ActionContextType ContextType { get; set; }
            /// <summary>
            /// Azione
            /// </summary>
            public int ActionType { get; set; }
            /// <summary>
            /// Descrizione dell'azione
            /// </summary>
            public string ActionDescription { get; set; }
            #endregion

            #region Costruttore
            /// <summary>
            /// Costruttore
            /// </summary>
            public ProgressEventArgs()
            {

            }
            /// <summary>
            /// Costruttore
            /// </summary>
            /// <param name="currentStep"></param>
            /// <param name="stepCount"></param>
            /// <param name="contextType"></param>
            /// <param name="actionType"></param>
            /// <param name="actionDescription"></param>
            public ProgressEventArgs(int currentStep, int stepCount, ActionContextType contextType = ActionContextType.None, int actionType = 0, string actionDescription = "") : this()
            {
                CurrentStep = currentStep;
                StepCount = stepCount;
                ContextType = contextType;
                ActionType = actionType;
                ActionDescription = actionDescription;
            }
            #endregion
        }
    }
}
