#pragma once

#include <windows.h>
#include <stdlib.h>
#include <vector>
#include <glm.hpp>
#include <QPainter>
#include <QTime>
#include "Constants.hpp"
#include "TransitionTypes.hpp"
#include "Chart.hpp"
#include "BarChart.hpp"
#include "GroupedBarChart.hpp"
#include "StackedBarChart.hpp"
#include "PieChart.hpp"

/*
   Class: Transition

     *Abstract* class that implements the skeleton of a transition.
*/
class Transition {
  public:
    /*
       Constructor: Transition

         Unused constructor of abstract class.
    */
    Transition();

    /*
       Destructor: ~Transition

         *Virtual*. Releases all allocated resources.
    */
    virtual ~Transition();


    /*
       Function: GetType

         Returns the type indicator of the class.

       Returns:

         The type indicator of the class.
    */
    int GetType();

    /*
       Function: GetResultChart

         Returns the resulting chart of the transition.

       Returns:

         The resulting chart of the transition.
    */
    Chart* GetResultChart();

    /*
       Function: AddTransition

         Adds the transition as child transition.

       Parameters:

         pTransition - The transition to be added.
    */
    void AddTransition(Transition* pTransition);

    /*
       Function: Start

         Starts the transition and makes it processable.
    */
    void Start();


    /*
       Function: Update

         *Virtual*. Updates the transition by executing itself ot its active child transitions.
    */
    virtual void Update() = 0;

    /*
       Function: Complete

         *Virtual*. Checks if the transition and all of its child transitions are completed.

       Returns:

         A boolean value indicating if the transition and all of its child transitions are completed.
    */
    virtual bool Complete() = 0;

  protected:
    bool bStarted;
    int iType;
    Chart* pInitialChart;
    Chart* pResultChart;
    std::vector<Transition*> vChildren;
    std::vector<AlterableObject*> vToBeDeleted;
    QTime oStartTime;
};