import React from 'react';
import { SvgXml } from 'react-native-svg';

import { CONNECTOR_BRAND_ICON_XML } from './connectorBrandIcons.generated';

export function hasConnectorBrandIcon(connectorId: string) {
  return !!CONNECTOR_BRAND_ICON_XML[connectorId];
}

export function ConnectorBrandIcon({ connectorId, size }: { connectorId: string; size: number }) {
  const xml = CONNECTOR_BRAND_ICON_XML[connectorId];
  if (!xml) {
    return null;
  }

  return <SvgXml height={size} width={size} xml={xml} />;
}
