import globals from '../globals';
import { getThemeRefs } from '../../helpers/themeHelpers';
import { TextFieldClass } from '../../components/descope-text-field/TextFieldClass';
import { refs } from './inputWrapper';

const globalRefs = getThemeRefs(globals);
const vars = TextFieldClass.cssVarList;

export const textField = {
  [vars.hostWidth]: refs.width,
  [vars.hostMinWidth]: refs.minWidth,
  [vars.hostDirection]: refs.direction,
  [vars.fontSize]: refs.fontSize,
  [vars.fontFamily]: refs.fontFamily,
  [vars.labelFontSize]: refs.labelFontSize,
  [vars.labelFontWeight]: refs.labelFontWeight,
  [vars.labelTextColor]: refs.labelTextColor,
  [vars.labelRequiredIndicator]: refs.requiredIndicator,
  [vars.errorMessageTextColor]: refs.errorMessageTextColor,
  [vars.inputValueTextColor]: refs.valueTextColor,
  [vars.inputPlaceholderColor]: refs.placeholderTextColor,
  [vars.inputBorderWidth]: refs.borderWidth,
  [vars.inputBorderStyle]: refs.borderStyle,
  [vars.inputBorderColor]: refs.borderColor,
  [vars.inputBorderRadius]: refs.borderRadius,
  [vars.inputOutlineWidth]: refs.outlineWidth,
  [vars.inputOutlineStyle]: refs.outlineStyle,
  [vars.inputOutlineColor]: refs.outlineColor,
  [vars.inputOutlineOffset]: refs.outlineOffset,
  [vars.inputBackgroundColor]: refs.backgroundColor,
  [vars.inputHeight]: refs.inputHeight,
  [vars.inputHorizontalPadding]: refs.horizontalPadding,
  [vars.helperTextColor]: refs.helperTextColor,
  [vars.textAlign]: refs.textAlign,
  textAlign: {
    right: { [vars.inputTextAlign]: 'right' },
    left: { [vars.inputTextAlign]: 'left' },
    center: { [vars.inputTextAlign]: 'center' },
  },
  [vars.labelPosition]: refs.labelPosition,
  [vars.labelTopPosition]: refs.labelTopPosition,
  [vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
  [vars.inputTransformY]: refs.inputTransformY,
  [vars.inputTransition]: refs.inputTransition,
  [vars.marginInlineStart]: refs.marginInlineStart,
  [vars.placeholderOpacity]: refs.placeholderOpacity,
  [vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
  [vars.valueInputHeight]: refs.valueInputHeight,
  [vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
  [vars.inputIconOffset]: globalRefs.spacing.md,
  [vars.inputIconSize]: refs.inputIconSize,
  [vars.inputIconColor]: refs.placeholderTextColor,

  // error message icon
  [vars.errorMessageIcon]: refs.errorMessageIcon,
  [vars.errorMessageIconSize]: refs.errorMessageIconSize,
  [vars.errorMessageIconPadding]: refs.errorMessageIconPadding,
  [vars.errorMessageIconRepeat]: refs.errorMessageIconRepeat,
  [vars.errorMessageIconPosition]: refs.errorMessageIconPosition,
  [vars.errorMessageFontSize]: refs.errorMessageFontSize,

  // obfuscated
  [vars.inputTextSecurity]: refs.inputTextSecurity,
};

export default textField;
export { vars };
