#include "console_tab_helpers.h"

#include <algorithm>

namespace dragonx {
namespace ui {

float ComputeConsoleInputHeight(float frameHeightWithSpacing,
                                float itemSpacingY,
                                float spacingSm,
                                float spacingXs,
                                float cursorOffset)
{
    return spacingSm + itemSpacingY + frameHeightWithSpacing + spacingSm + spacingXs + cursorOffset;
}

float ComputeConsoleOutputHeight(float availableHeight,
                                 float inputHeight,
                                 float minHeight,
                                 float minHeightRatio)
{
    return std::max(availableHeight - inputHeight, std::max(minHeight, availableHeight * minHeightRatio));
}

float ClampConsoleWrapWidth(float contentWidth, float paddingX)
{
    return std::max(50.0f, contentWidth - paddingX * 2.0f);
}

} // namespace ui
} // namespace dragonx
