import ResponsivePaddingFormatter from './responsive-padding-formatter';
import ResponsiveMarginFormatter from './responsive-margin-formatter';
import ResponsiveGapFormatter from './responsive-gap-formatter';
import ResponsiveColumnsFormatter from './responsive-grid-columns-formatter';
import ResponsiveRowsFormatter from './responsive-grid-rows-formatter';
import ResponsiveGridJustifyItemsFormatter from './responsive-grid-justify-items-formatter';
import ResponsiveSizeFormatter from './responsive-size-formatter';
import ResponsiveTranslocationFormatter from './responsive-translocation-formatter';
import ResponsiveDisplayFormatter from './responsive-display-formatter';
import ResponsiveFlexDirectionFormatter from './responsive-flex-direction-formatter';
import ResponsiveFlexAlignItemFormatter from './responsive-flex-align-item-formatter';
import ResponsiveFlexJustifyContentFormatter from './responsive-flex-justify-content-formatter';
import ResponsiveFlexWrapFormatter from './responsive-flex-wrap-formatter';
import ResponsiveCustomFormatterSingleton from './responsive-custom-formatter';
import ResponsiveBoxDisplayFormatter from './responsive-box-display-formatter';
import ResponsiveWidthAndHeightFormatter from './responsive-width-and-height-formatter';
import ResponsiveBorderRadiusFormatter from './responsiv-border-radius-formatter';
import ResponsiveTextAlignFormatter from './responsive-text-align-formatter';
import responsivePaddingStyleFormatter from './responsive-padding-style-formatter';
import responsiveMarginStyleFormatter from './responsive-margin-style-formatter';
import responsiveBorderRadiusStyleFormatter from './responsive-border-radius-style-formatter';
/**
 * A facade class for delegating format input with different responsive formatters given the flag:
 *
 * @requires ResponsivePaddingFormatter
 * @requires ResponsiveMarginFormatter
 * @requires ResponsiveGapFormatter
 * @requires ResponsiveColumnFormatter
 * @requires ResponsiveRowFormatter
 */
class ResponsiveFormatFacade {
  /**
   * It takes in a flag and a responsive type, and returns a formatted responsive type
   *
   * @typedef Flag key of ManagedResponsiveScopeInput
   * @param {ResponsiveType<ManagedResponsiveScopeInput[Flag]>} input - The input value to be formatted
   * @param {Flag} flag - The flag that is being formatted.
   * @returns {ManagedResponsiveScopeOutput[Flag]} The return type is a union of all the possible return types of the formatters.
   */
  format(input, flag) {
    switch (flag) {
      case 'padding':
        return ResponsivePaddingFormatter.format(input);
      case 'margin':
        return ResponsiveMarginFormatter.format(input);
      case 'gap':
        return ResponsiveGapFormatter.format(input);
      case 'gridColumn':
        return ResponsiveColumnsFormatter.format(input);
      case 'gridRow':
        return ResponsiveRowsFormatter.format(input);
      case 'gridJustifyItems':
        return ResponsiveGridJustifyItemsFormatter.format(input);
      case 'size':
        return ResponsiveSizeFormatter.format(input);
      case 'translocation':
        return ResponsiveTranslocationFormatter.format(input);
      case 'display':
        return ResponsiveDisplayFormatter.format(input);
      case 'flexDirection':
        return ResponsiveFlexDirectionFormatter.format(input);
      case 'flexAlignItem':
        return ResponsiveFlexAlignItemFormatter.format(input);
      case 'flexJustifyContent':
        return ResponsiveFlexJustifyContentFormatter.format(input);
      case 'flexWrap':
        return ResponsiveFlexWrapFormatter.format(input);
      case 'boxDisplay':
        return ResponsiveBoxDisplayFormatter.format(input);
      case 'widthAndHeight':
        return ResponsiveWidthAndHeightFormatter.format(input);
      case 'corners':
        return ResponsiveBorderRadiusFormatter.format(input);
      case 'textAlign':
        return ResponsiveTextAlignFormatter.format(input);
      case 'paddingStyle':
        return responsivePaddingStyleFormatter.format(input);
      case 'marginStyle':
        return responsiveMarginStyleFormatter.format(input);
      case 'cornersStyle':
        return responsiveBorderRadiusStyleFormatter.format(input);
      default:
        throw new Error(`Invalid flag ${flag} passed into ResponsiveFormatFacade`);
    }
  }
  /**
   * Given a responsive type and a flag, return the formatted CSS class string.
   *
   * @typedef T generic type parameter
   * @param {ResponsiveType<T>} input - ResponsiveType<T>
   * @returns {T} - return the formatted T.
   */
  formatCustom(input) {
    return ResponsiveCustomFormatterSingleton.format(input);
  }
}
export default new ResponsiveFormatFacade();
