/** Includes ***********************/
#include "EventManager/Event.h"

/** Macros *************************/

/** Variables **********************/

/** Forward Declarations ***********/

/** Implementations ****************/
namespace CKG
{
    namespace Lib
    {
        namespace EventManager
        {
            /*!
                \brief  Default Event constructor
            */
            Event::Event(const Char *eventInfo, const int numTriggers, const DateTime *triggers)
                : mEventInformation(eventInfo)
            {
                mTriggers.reserve(numTriggers);

                for (int i = 0; i < numTriggers; i++)
                {
                    mTriggers.push_back(triggers[i]);
                }
            }

            /*!
                \brief  Destroys an event
            */
            Event::~Event()
            {

            }

            /*!
                \brief  Sets the event information

                \param  eventInfo       - Information for the event
                \return                 - void.
            */
            void Event::SetEventInformation(const Char *eventInfo)
            {
                mEventInformation = stlport::string(eventInfo);
            }

            /*!
                \brief  Should this event be triggered

                \param  currentDateTime     - Time to compare against
                \return                     - True if the event should trigger
            */
            bool Event::ShouldTrigger(const DateTime &currentDateTime) const
            {
                TriggerList::const_iterator iter = mTriggers.begin(), end = mTriggers.end();

                for (; iter != end; ++iter)
                {
                    if (currentDateTime.GetTime() < iter->GetTime())
                    {
                        return true;
                    }
                }

                return false;
            }
        }
    }
}
