import { isBackgroundColorTokenType } from '../../../types/type-guard';
import { LogUtility } from '../../../utils/log';
import { StateVariantFormatter } from './state-variant-formatter';
import { BackgroundColorMap, BackgroundColors } from '../../../constants/public-api';
/**
 * The `StateBackgroundColorFormatter` class in TypeScript formats background color tokens
 * and handles different CSS states.
 */
class StateBackgroundColorFormatter extends StateVariantFormatter {
  constructor() {
    super(...arguments);
    this.states = ['default', 'hover', 'active', 'focus-visible'];
  }
  /**
   * The function `formatToken` takes a `BackgroundColorsTokenType` input, checks if it is a valid
   * background color token type, and returns the corresponding CSS background color value or logs a
   * warning if the input is invalid.
   *
   * @param {BackgroundColorsTokenType} input - The `input` parameter is of type
   * `BackgroundColorsTokenType`, which is used to represent different background color tokens.
   * @returns {string} The `formatToken` function takes a `BackgroundColorsTokenType` input and checks if it is a
   * valid background color token type. If it is valid, it retrieves the corresponding color value from
   * the `BackgroundColorMap` and returns a CSS style string with the background color. If the input is
   * not valid, it logs a warning message using `LogUtility.warn` and returns an empty string.
   */
  formatToken(input) {
    if (isBackgroundColorTokenType(input)) {
      const tokenValue = BackgroundColorMap[input];
      return `background-color: ${tokenValue};`;
    }
    else {
      LogUtility.warn(`The backgroundColor value ${input} is invalid, it must be a value of: `, BackgroundColors);
      return '';
    }
  }
  /**
   * The function `getStates` returns an array of `CssStatesType` objects.
   *
   * @returns {CssStatesType[]} An array of objects of type CssStatesType, which represents the states stored in the
   * variable this.states.
   */
  getStates() {
    return this.states;
  }
}
export default new StateBackgroundColorFormatter();
