'use strict';

const typeGuard = require('./type-guard-c1195e50.js');
const responsiveFormatFacade = require('./responsive-format-facade-9647775d.js');

/**
 * Fomatter flex styles.
 *
 * @param {Nullable<ResponsiveType<FlexType>>} flex - flex
 * @param {Nullable<ResponsiveType<FlexGrowType>>} flexGrow - flex-grow
 * @param {Nullable<ResponsiveType<FlexShrinkType>>} flexShrink - flex-shrink
 * @param {Nullable<ResponsiveType<FlexBasisType>>} flexBasis - flex-basis
 * @returns {FormattedStylesType} - formatted styles
 */
function formatFlexStyles(flex, flexGrow, flexShrink, flexBasis) {
  if (typeGuard.isNonNullable(flex)) {
    return { flex: `${responsiveFormatFacade.ResponsiveFormatFacade.formatCustom(flex)}` };
  }
  else {
    return {
      flexGrow: typeGuard.isNonNullable(flexGrow)
        ? `${responsiveFormatFacade.ResponsiveFormatFacade.formatCustom(flexGrow)}`
        : undefined,
      flexShrink: typeGuard.isNonNullable(flexShrink)
        ? `${responsiveFormatFacade.ResponsiveFormatFacade.formatCustom(flexShrink)}`
        : undefined,
      flexBasis: typeGuard.isNonNullable(flexBasis)
        ? `${responsiveFormatFacade.ResponsiveFormatFacade.formatCustom(flexBasis)}`
        : undefined,
    };
  }
}

exports.formatFlexStyles = formatFlexStyles;
