import { BrandingOverlayType } from '@bifold/oca/build/legacy';
import { Image, View } from 'react-native';
import { toImageSource } from '../../utils/credential';
import { useTheme } from '../../contexts/theme';
import { testIdWithKey } from '../../utils/testable';
import useCredentialCardStyles from '../../hooks/credential-card-styles';
import { TOKENS, useServices } from '../../container-api';
import { ThemedText } from '../../components/texts/ThemedText';
const CredentialCard11Logo = ({
  noLogoText,
  overlay,
  elevated
}) => {
  var _overlay$brandingOver, _overlay$brandingOver2, _overlay$brandingOver3, _overlay$brandingOver4;
  const {
    TextTheme
  } = useTheme();
  const [bundleResolver] = useServices([TOKENS.UTIL_OCA_RESOLVER]);
  const isBranding11 = bundleResolver.getBrandingOverlayType() === BrandingOverlayType.Branding11;
  const textColor = (_overlay$brandingOver = overlay.brandingOverlay) !== null && _overlay$brandingOver !== void 0 && _overlay$brandingOver.secondaryBackgroundColor && overlay.brandingOverlay.secondaryBackgroundColor !== '' ? overlay.brandingOverlay.secondaryBackgroundColor : (_overlay$brandingOver2 = overlay.brandingOverlay) === null || _overlay$brandingOver2 === void 0 ? void 0 : _overlay$brandingOver2.primaryBackgroundColor;
  const {
    styles,
    logoHeight
  } = useCredentialCardStyles(overlay, bundleResolver.getBrandingOverlayType());
  return /*#__PURE__*/React.createElement(View, {
    style: [styles.logoContainer, {
      elevation: elevated ? 5 : 0
    }]
  }, (_overlay$brandingOver3 = overlay.brandingOverlay) !== null && _overlay$brandingOver3 !== void 0 && _overlay$brandingOver3.logo ? /*#__PURE__*/React.createElement(Image, {
    source: toImageSource((_overlay$brandingOver4 = overlay.brandingOverlay) === null || _overlay$brandingOver4 === void 0 ? void 0 : _overlay$brandingOver4.logo),
    style: {
      resizeMode: 'cover',
      width: logoHeight,
      height: logoHeight,
      borderRadius: 8
    },
    testID: testIdWithKey('Logo')
  }) : /*#__PURE__*/React.createElement(ThemedText, {
    variant: "bold",
    style: [TextTheme.bold, {
      fontSize: 0.5 * logoHeight,
      alignSelf: 'center',
      color: isBranding11 ? textColor : '#000'
    }],
    testID: testIdWithKey('NoLogoText')
  }, noLogoText.charAt(0).toUpperCase()));
};
export default CredentialCard11Logo;
//# sourceMappingURL=CredentialCard11Logo.js.map