/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include <dawn/dawn.h>

/**
 * Initialize the queue set.
 * @param queue Queue to initialize.
 */
void queueInit(queue_t *queue);

/**
 * Goes to the next action, or start the queue  if this is the first action.
 * @param queue Queue to skip to the next action.
 * @returns Action that was just started.
 */
queueaction_t * queueNext(queue_t *queue);

/**
 * Add a queue action to the queue.
 * @param convo Queue to add to.
 * @return Pointer to the queue action that was added.
 */
queueaction_t * queueAdd(queue_t *queue);

/**
 * Updates the queue logic.
 * @param convo Queue to update.
 * @param engine Engine used to update.
 */
void queueUpdate(queue_t *queue, engine_t *engine);

/**
 * Dispose the queue when finished.
 * @param queue Queue to dispose.
 */
void queueDispose(queue_t *queue);


/** Callbacks for Queue Delay Action */
void _queueDelayUpdate(queue_t *queue, queueaction_t *action, uint8_t i);

/**
 * Adds a delay action to a queue.
 * @param queue Queue to add to.
 * @param delay Delay time (in seconds) to have.
 * @return Pointer to the action added to the queue.
 */
queueaction_t * queueDelay(queue_t *queue, float delay);