import { css } from 'styled-components';
import { getColorAlias, getSpacing } from '../../utils/index.js';

function formatCharCount(count) {
    if (count === undefined || count < 0)
        return null;
    if (count === 0)
        return '00';
    if (count < 10)
        return '0' + count;
    return count.toString();
}
function getCharacterCount(charCount, maxCharacters) {
    const maxChar = formatCharCount(maxCharacters);
    const maxCharFormatted = maxChar ? `/${maxChar}` : '';
    return `${formatCharCount(charCount)}${maxCharFormatted}`;
}
function getBorderColor(disabled, error) {
    if (!disabled && error)
        return getColorAlias('supportError');
    return getColorAlias('interactiveForm');
}
const getFieldPadding = (variant) => {
    switch (variant) {
        case 'small':
            return css `
        padding: ${getSpacing('s02', 's04')};
      `;
        case 'medium':
            return css `
        padding: ${getSpacing('s03', 's04')};
      `;
        case 'large':
            return css `
        padding: ${getSpacing('s04')};
      `;
        default:
            return css `
        padding: ${getSpacing('s03', 's04')};
      `;
    }
};
const getTextAreaPadding = (variant) => {
    switch (variant) {
        case 'small':
            return css `
        padding: ${getSpacing('s02', 's04')};
        min-height: 64px;
      `;
        case 'medium':
            return css `
        padding: ${getSpacing('s03', 's04')};
        min-height: 72px;
      `;
        case 'large':
            return css `
        padding: ${getSpacing('s04')};
        min-height: 80px;
      `;
        default:
            return css `
        padding: ${getSpacing('s03', 's04')};
        min-height: 72px;
      `;
    }
};
const getCheckRadioIconColor = (disabled) => {
    return disabled ? '8C999B' : 'ffffff';
};

export { formatCharCount, getBorderColor, getCharacterCount, getCheckRadioIconColor, getFieldPadding, getTextAreaPadding };
