// MobileGL - MobileGL/MG_Util/Converters/EGLToStr/EGLEnumConverter.cpp
// Copyright (c) 2025-2026 MobileGL-Dev
// Licensed under the GNU Lesser General Public License v3.0:
//   https://www.gnu.org/licenses/gpl-3.0.txt
//   https://www.gnu.org/licenses/lgpl-3.0.txt
// SPDX-License-Identifier: LGPL-3.0-only
// End of Source File Header

#include "EGLEnumConverter.h"
#include <GL/gl.h>

namespace MobileGL {
    namespace MG_Util {
        String ConvertEGLEnumToString(EGLenum value) {
            switch (value) {
#define CASE(value)                                                                                                    \
    case value:                                                                                                        \
        return #value;

                CASE(EGL_ALPHA_SIZE)
                CASE(EGL_BAD_ACCESS)
                CASE(EGL_BAD_ALLOC)
                CASE(EGL_BAD_ATTRIBUTE)
                CASE(EGL_BAD_CONFIG)
                CASE(EGL_BAD_CONTEXT)
                CASE(EGL_BAD_CURRENT_SURFACE)
                CASE(EGL_BAD_DISPLAY)
                CASE(EGL_BAD_MATCH)
                CASE(EGL_BAD_NATIVE_PIXMAP)
                CASE(EGL_BAD_NATIVE_WINDOW)
                CASE(EGL_BAD_PARAMETER)
                CASE(EGL_BAD_SURFACE)
                CASE(EGL_BLUE_SIZE)
                CASE(EGL_BUFFER_SIZE)
                CASE(EGL_CONFIG_CAVEAT)
                CASE(EGL_CONFIG_ID)
                CASE(EGL_CORE_NATIVE_ENGINE)
                CASE(EGL_DEPTH_SIZE)
                CASE(EGL_DRAW)
                CASE(EGL_EXTENSIONS)
                CASE(EGL_FALSE)
                CASE(EGL_GREEN_SIZE)
                CASE(EGL_HEIGHT)
                CASE(EGL_LARGEST_PBUFFER)
                CASE(EGL_LEVEL)
                CASE(EGL_MAX_PBUFFER_HEIGHT)
                CASE(EGL_MAX_PBUFFER_PIXELS)
                CASE(EGL_MAX_PBUFFER_WIDTH)
                CASE(EGL_NATIVE_RENDERABLE)
                CASE(EGL_NATIVE_VISUAL_ID)
                CASE(EGL_NATIVE_VISUAL_TYPE)
                CASE(EGL_NONE)
                CASE(EGL_NON_CONFORMANT_CONFIG)
                CASE(EGL_NOT_INITIALIZED)
                CASE(EGL_PIXMAP_BIT)
                CASE(EGL_READ)
                CASE(EGL_RED_SIZE)
                CASE(EGL_SAMPLES)
                CASE(EGL_SAMPLE_BUFFERS)
                CASE(EGL_SLOW_CONFIG)
                CASE(EGL_STENCIL_SIZE)
                CASE(EGL_SUCCESS)
                CASE(EGL_SURFACE_TYPE)
                CASE(EGL_TRANSPARENT_BLUE_VALUE)
                CASE(EGL_TRANSPARENT_GREEN_VALUE)
                CASE(EGL_TRANSPARENT_RED_VALUE)
                CASE(EGL_TRANSPARENT_RGB)
                CASE(EGL_TRANSPARENT_TYPE)
                CASE(EGL_TRUE)
                CASE(EGL_VENDOR)
                CASE(EGL_VERSION)
                CASE(EGL_WIDTH)
                CASE(EGL_WINDOW_BIT)
                CASE(EGL_BACK_BUFFER)
                CASE(EGL_BIND_TO_TEXTURE_RGB)
                CASE(EGL_BIND_TO_TEXTURE_RGBA)
                CASE(EGL_CONTEXT_LOST)
                CASE(EGL_MIN_SWAP_INTERVAL)
                CASE(EGL_MAX_SWAP_INTERVAL)
                CASE(EGL_MIPMAP_TEXTURE)
                CASE(EGL_MIPMAP_LEVEL)
                CASE(EGL_NO_TEXTURE)
                CASE(EGL_TEXTURE_2D)
                CASE(EGL_TEXTURE_FORMAT)
                CASE(EGL_TEXTURE_RGB)
                CASE(EGL_TEXTURE_RGBA)
                CASE(EGL_TEXTURE_TARGET)
                CASE(EGL_ALPHA_FORMAT)
                CASE(EGL_ALPHA_FORMAT_NONPRE)
                CASE(EGL_ALPHA_FORMAT_PRE)
                CASE(EGL_ALPHA_MASK_SIZE)
                CASE(EGL_BUFFER_PRESERVED)
                CASE(EGL_BUFFER_DESTROYED)
                CASE(EGL_CLIENT_APIS)
                CASE(EGL_COLORSPACE)
                CASE(EGL_COLORSPACE_sRGB)
                CASE(EGL_COLORSPACE_LINEAR)
                CASE(EGL_COLOR_BUFFER_TYPE)
                CASE(EGL_CONTEXT_CLIENT_TYPE)
                CASE(EGL_DISPLAY_SCALING)
                CASE(EGL_HORIZONTAL_RESOLUTION)
                CASE(EGL_LUMINANCE_BUFFER)
                CASE(EGL_LUMINANCE_SIZE)
                CASE(EGL_OPENGL_ES_API)
                CASE(EGL_OPENVG_API)
                CASE(EGL_OPENVG_IMAGE)
                CASE(EGL_PIXEL_ASPECT_RATIO)
                CASE(EGL_RENDERABLE_TYPE)
                CASE(EGL_RENDER_BUFFER)
                CASE(EGL_RGB_BUFFER)
                CASE(EGL_SINGLE_BUFFER)
                CASE(EGL_SWAP_BEHAVIOR)
                CASE(EGL_VERTICAL_RESOLUTION)
                CASE(EGL_CONFORMANT)
                CASE(EGL_CONTEXT_CLIENT_VERSION)
                CASE(EGL_MATCH_NATIVE_PIXMAP)
                CASE(EGL_VG_COLORSPACE_LINEAR_BIT)
                CASE(EGL_MULTISAMPLE_RESOLVE_BOX_BIT)
                CASE(EGL_MULTISAMPLE_RESOLVE)
                CASE(EGL_MULTISAMPLE_RESOLVE_DEFAULT)
                CASE(EGL_MULTISAMPLE_RESOLVE_BOX)
                CASE(EGL_OPENGL_API)
                CASE(EGL_CONTEXT_MINOR_VERSION)
                CASE(EGL_CONTEXT_OPENGL_PROFILE_MASK)
                CASE(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY)
                CASE(EGL_NO_RESET_NOTIFICATION)
                CASE(EGL_LOSE_CONTEXT_ON_RESET)
                CASE(EGL_CONTEXT_OPENGL_DEBUG)
                CASE(EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE)
                CASE(EGL_CONTEXT_OPENGL_ROBUST_ACCESS)
                CASE(EGL_OPENGL_ES3_BIT)
                CASE(EGL_CL_EVENT_HANDLE)
                CASE(EGL_SYNC_CL_EVENT)
                CASE(EGL_SYNC_CL_EVENT_COMPLETE)
                CASE(EGL_SYNC_PRIOR_COMMANDS_COMPLETE)
                CASE(EGL_SYNC_TYPE)
                CASE(EGL_SYNC_STATUS)
                CASE(EGL_SYNC_CONDITION)
                CASE(EGL_SIGNALED)
                CASE(EGL_UNSIGNALED)
                CASE(EGL_TIMEOUT_EXPIRED)
                CASE(EGL_CONDITION_SATISFIED)
                CASE(EGL_SYNC_FENCE)
                CASE(EGL_GL_COLORSPACE)
                CASE(EGL_GL_RENDERBUFFER)
                CASE(EGL_GL_TEXTURE_2D)
                CASE(EGL_GL_TEXTURE_LEVEL)
                CASE(EGL_GL_TEXTURE_3D)
                CASE(EGL_GL_TEXTURE_ZOFFSET)
                CASE(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X)
                CASE(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X)
                CASE(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y)
                CASE(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y)
                CASE(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z)
                CASE(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)
                CASE(EGL_IMAGE_PRESERVED)

            default:
                return std::format("0x%x", value);
            }
#undef CASE
        }
    } // namespace MG_Util
} // namespace MobileGL