using System;

namespace CPF
{

    public enum Signal
    {
        Null        = 0,
        Init        = 1,
        Entry       = 2,
        DeepHistory = 3,  // Record Deep History
        Exit        = 4,
        User        = 5
    };

    public class Event
    {
        public Signal   _signal;
        public double   _double;
        public int      _integer;

        public Event()
        {
            _signal = Signal.Null;
            _double = 0.0;
            _integer = 0;
        }

        public Event(Signal signal)
        {
            _signal = signal;
        }

        public Event(Signal signal, double value)
        {
            _signal = signal;
            _double = value;
        }

        public Event(Signal signal, int value)
        {
            _signal = signal;
            _integer = value;
        }

        public override string ToString()
        {
            switch (_signal)
            {
                case Signal.Null            :
                    return "Null";

                case Signal.Init            :
                    return "Init";

                case Signal.Entry           :
                    return "Entry";

                case Signal.DeepHistory     :
                    return "DeepHistory";

                case Signal.Exit            :
                    return "Entry";

                default                     :
                    return "User";
            }
        }
        public static Event NullEvent = new Event(Signal.Null);
        public static Event InitEvent = new Event(Signal.Init);
        public static Event EntryEvent = new Event(Signal.Entry);
        public static Event DeepHistoryEvent = new Event(Signal.DeepHistory);
        public static Event ExitEvent = new Event(Signal.Exit);
        public static Event UserEvent = new Event(Signal.User);
    }

    public delegate State State(Event e);
}
