// @flow
import { getPaletteColor } from '../../../../mixins/branding/branding.css-rules';
import { type ThemeProps } from '../../../../types';
import { type Level } from './toast.proptypes';
import { DEFAULT_BG_COLOR } from './toast.constants';

export const getBackgroundColor = ({
  theme,
  level,
}: ThemeProps & { level: Level }) => {
  switch (level) {
    case 'success':
      return getPaletteColor('success-fg')({ theme });
    case 'error':
      return getPaletteColor('error-fg')({ theme });
    case 'info':
      return getPaletteColor('info-fg')({ theme });
    default:
      return getPaletteColor(DEFAULT_BG_COLOR)({ theme });
  }
};
