import { FeatureFlag } from '../../feature-control/feature-flag-controller';
import { CreditCardMaskStrategy } from './credit-card-mask-strategy.abstract';
/**
 * A class for formatting string with the given mask format
 *
 * @augments StringFormatStrategy
 */
export class CreditCardInputMaskStrategy extends CreditCardMaskStrategy {
  /**
   * It creates a new instance of the Mask class.
   */
  constructor() {
    super({
      mask: '',
      slot: '9',
      accept: /\d/,
      triggerAtInit: FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
    });
  }
  /**
   * get credit card mask config
   *
   * @param {string} value - card number string
   * @returns {Nullable<MaskConfigType>} - mask config type
   */
  getCreditCardMaskConfig(value) {
    let maskConfig;
    const creditCardType = this.getCreditCardType(value);
    if (creditCardType) {
      maskConfig = creditCardType.maskConfig;
    }
    return maskConfig;
  }
}
