#ifndef ARC_GRAPHICS_VIEW_H_
#define ARC_GRAPHICS_VIEW_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "arc/graphics/renderer.h"
#include "arc/math/rectangle.h"

typedef struct ARC_View {
    ARC_Renderer *renderer;
    ARC_Rect bounds;
} ARC_View;

/**
 * @brief a function for ARC_View where contents of the function will be rendered within a view
 *
 * @param data data to be used within ARC_View_RenderFn
 */
typedef void (* ARC_View_RenderFn)(void *data);

/**
 * @brief creates ARC_View type
 *
 * @param view     ARC_View to initialize
 * @param renderer ARC_Renderer the view will render to
 * @param bounds   ARC_Rect bounds of the view within the renderer 
 */
void ARC_View_Create(ARC_View **view, ARC_Renderer *renderer, ARC_Rect bounds);

/**
 * @brief destroys ARC_View type
 */
void ARC_View_Destroy(ARC_View *view);

/**
 * @brief renders callbacks contents within an ARC_View
 * 
 * @param view     ARC_View to be renedered to
 * @param renderFn function which contents will render to given ARC_View
 * @param data     data to be used in renderFn
 */
void ARC_View_Render(ARC_View *view, ARC_View_RenderFn renderFn, void *data);

/**
 * @brief gets bounds from ARC_View type
 *
 * @param view ARC_View to get bounds from
 *
 * @return bounds of the view
 */
ARC_Rect ARC_View_GetBounds(ARC_View *view);

#ifdef __cplusplus
}
#endif

#endif // !ARC_GRAPHICS_VIEW_H_
