#pragma once

#include <Core/Common/CoreTypes.h>
#include <Juliet.h>

namespace Juliet
{
    extern JULIET_API float RoundF(float value);

    inline int32 LRoundF(float value)
    {
        return static_cast<int32>(RoundF(value));
    }

    template <typename Type>
    constexpr Type Min(Type lhs, Type rhs)
    {
        return rhs < lhs ? rhs : lhs;
    }

    template <typename Type>
    constexpr Type Max(Type lhs, Type rhs)
    {
        return lhs < rhs ? rhs : lhs;
    }

    template <typename Type>
    constexpr Type ClampTop(Type value, Type X)
    {
        return Min(value, X);
    }

    template <typename Type>
    constexpr Type ClampBottom(Type value, Type X)
    {
        return Max(value, X);
    }

    template <typename Type>
    constexpr Type Clamp(Type val, Type min, Type max)
    {
        if (val < min)
        {
            return min;
        }
        if (val > max)
        {
            return max;
        }
        return val;
    }
} // namespace Juliet
