#pragma once

#include "../../vector/vector.h"
#include "../operation/operation.h"

typedef struct {
    Vector* operations;
    int index;
} UndoController;

/*
    Constructor for the UndoController
    Input: -
    Output: a pointer to the newly created UndoController
*/
UndoController* _UndoController_Constructor();

/*
    Destructor for the UndoController
    Input: undo_controller - UndoController*
    Output: -
*/
void _UndoController_Destructor(UndoController* undo_controller);

/*
    Adds an operation to the UndoController
    Input: undo_controller - UndoController*
           operation - Operation* - the operation to be added
    Output: -
*/
void _UndoController_recordOperation(UndoController* undo_controller,Operation* operation);

/*
    Undoes the last operation
    Input: undo_controller - UndoController*
    Output: 1 - if the operation was undone
            0 - if the operation was not undone
*/
int _UndoController_undo(UndoController* undo_controller);

/*
    Redoes the last operation
    Input: undo_controller - UndoController*
    Output: 1 - if the operation was redone
            0 - if the operation was not redone
*/
int _UndoController_redo(UndoController* undo_controller);
