import { isSpacingTokenType, isDirectionalSpacingType, isBreakpointsForPrefixType, } from '../../../types/type-guard';
import { LogUtility } from '../../../utils/log';
import { Spacing } from '../../../constants/tokens/spacing';
import { ResponsiveClassStringFormatter } from './responsive-class-string-formatter';
const PADDING_DIRECTION_CLASS_PARTIAL_MAP = {
  top: 'pt',
  bottom: 'pb',
  left: 'pl',
  right: 'pr',
  x: 'px',
  y: 'py',
};
/**
 * A class for format PaddingType with BreakpointsForPrefixType to CSS class string
 *
 * @deprecated Please use the `ResponsivePaddingStyleFormatter` instead.
 * @augments ResponsiveClassStringFormatter
 */
class ResponsivePaddingFormatter extends ResponsiveClassStringFormatter {
  /**
   * Given a padding type, return the corresponding string of CSS class names
   *
   * @param {PaddingType} input - PaddingType
   * @param {BreakpointsForPrefixType} [breakpoint] - Breakpoints for prefix of the class
   * @returns {string} - A string of CSS classes.
   */
  formatToken(input, breakpoint) {
    const prefix = isBreakpointsForPrefixType(breakpoint) ? `${breakpoint}:` : '';
    if (isSpacingTokenType(input)) {
      return `${prefix}v-p-${input}`;
    }
    else if (isDirectionalSpacingType(input)) {
      return Object.keys(input)
        .map((direction) => {
        return `${prefix}v-${PADDING_DIRECTION_CLASS_PARTIAL_MAP[direction]}-${input[direction]}`;
      })
        .join(' ');
    }
    else {
      LogUtility.warn(`The padding value ${input} is invalid, it must be a value of: `, Spacing);
      return '';
    }
  }
}
export default new ResponsivePaddingFormatter();
