// =====================================================================================================================
//  fennec, a free and open source game engine
//  Copyright © 2025 - 2026  Medusa Slockbower
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================

///
/// \file fennec/renderers/interface/gfxcontext.h
/// \brief
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 - 2026 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///

#ifndef FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
#define FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H

#include <fennec/platform/interface/forward.h>

#include <fennec/core/version.h>
#include <fennec/lang/types.h>
#include <fennec/string/string.h>

#include <fennec/rtti/enable.h>

#include <fennec/renderers/interface/forward.h>

namespace fennec
{

///
/// \brief Interface resembling a broader context for a graphics API
class gfxcontext {

// Constructors & Destructor ===========================================================================================
public:

	/// \name Constructors & Destructor
	/// @{

	///
	/// \brief Context Constructor
	/// \param display The display server this context was created from
	gfxcontext(display_server* display)
		: display(display)
		, version() {
	}

	///
	/// \brief Virtual Destructor
	virtual ~gfxcontext() = default;

	/// @}


// Properties ==========================================================================================================
public:

	/// \name Properties
	/// @{

	///
	/// \brief Context Validity
	/// \returns \emph{true} if the context is initialized and valid, \emph{false} otherwise.
	virtual bool is_valid() = 0;

	///
	/// \returns A version struct containing the version of the graphics API.
	virtual const version& get_version() const {
		return version;
	}

	/// @}


// Operations ==========================================================================================================
public:

	/// \name Operations
	/// @{

	///
	/// \brief Create a surface under the context of the graphics API for the provided window.
	/// \param window The window to create a surface for.
	/// \returns A new graphics surface for the API.
	virtual gfxsurface* create_surface(window* window) = 0;

	/// @}


// Protected Member Variables ==========================================================================================
protected:
	display_server* const display; //!< The display server this context was created from.
	version               version; //!< The version of the underlying graphics API.

	FENNEC_RTTI_CLASS_ENABLE() {
	}
};

}

#endif // FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H