import React, { useMemo } from 'react';

import { Image } from '../Image/Image';
import { Button } from '../Button/Button';
import { ButtonProps } from '../Button/types';
import useTheme from '../../context/theme/useTheme';
import { Box } from '../Box';

export type SocialButtonProvider = 'google' | 'facebook' | 'apple' | 'twitter';

export interface SocialButtonProps extends Omit<ButtonProps, 'children'> {
  provider?: SocialButtonProvider;
  text?: string;
  iconSize?: number;
}

const SwitchProvidersTextMap: Record<SocialButtonProvider, string> = {
  google: 'Continue with Google',
  facebook: 'Continue with Facebook',
  apple: 'Continue with Apple',
  twitter: 'Continue with Twitter',
} as const;

const SwitchProvidersImageMap: Record<
  SocialButtonProvider,
  { light: string; dark: string }
> = {
  google: {
    light: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAAdVBMVEVHcEzxaSbqQzQ0qFM4n4HqQzU0qFRChfRChPRChfQzqFPuXS3uYivqQzXrQzU0qFXrQzU0qFM0qFP6uAf6uwb7ugXqQzX8vAVChfVDhPQ5m5DsUy/0hhpChfQ/jdBWrEaPsS/uuwrLtxjqQzU0qFP7vAVChfSSyhVQAAAAI3RSTlMADtfsE+7R7VXGOCE6l1CLuK9k2prycWKaNcPHx3PV4srCxi89pYIAAAPzSURBVGje7ZjrdqowEIXDJUGQu8qxta1agu//iAdR8UJCJmQia5119u+Wz9kzSXZCiLacuKqS3HUprWtK3V2eJ1W6JHYVV7lbi+UmtujLKqf1uFq4g07d1SDRJEXEpnmtIZrgeO5Ubq2rJEbA0nqKckP0RGyHNjA8dmsD0WTiiDt5bSg6acJTWptLv2jzcq97SvzO7j6pervNvd1wblKjaue8t70PjQaRnR02t07/cwVcFxsL3L3yeerFXketYBtXhe4zjJtqfpVSisJdQvdJmidpfDvml2mVuEZc4GC5ojzlpILoC+WCGixPcYNMCOUuzXNrupvAJeodCxCX075qCo16SqNhUcJJNLmOaqITrQwB5qq2LJ24uHRrF8xVTJarlc0djbvT2sWILhMuoc1mZKhza1yybprmi769XuJsWnCzcg2C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ASbej2nNJaB1b9k4bJXHRhCzYNg5fVZ0i6OkaAPgpWh/zpHue0ZrAZwHUtAVhXoq0VgPGaBeWIXmL82gXm1Dcz3UmflNNHV2FM8dSngaq3U+Jwu2gX2JjKDsfZ7O7hkKL1hsDmwMiwgpStZ47AkRx2s3SNdhDmrTDHeDll8BsM7UJAsZZ7HajVQTiE58K4xWXQy8vZNU25ANqOyjifJZrVB0S3ZgFS4rAIqIsXumuCyGrgoasFSqyQh1mCm56YwcWXjpTBH2KJkWAbbBtaPS7gGBdkIuMBuWtq1rgM7c4ZXSHfd+l6xFX/Ja3qSyUr6EVdXupOMvIZfh01Ruweuq77D4R/W9uUnxFH1DzSduBvvCiAWGaUt9o2HuospvPFQvnKaUnj0othtuipvDZbVWNdU7soFqfrslf1qqb02GFJs4k1nNpm1+cGviu9F0uGlbPk3/x9tvUXsyfdgzExDeLvvVJUfKrz0xpwYVPiJ9/2mxvOJ3o29+2L4+509h3E0UB25N37m8qJgqVKrc2OL4rT1DzQNg4PvD7hvAAAAAElFTkSuQmCC',
  },
} as const;

export const SocialButton: React.FC<SocialButtonProps> = ({
  text,
  provider,
  iconSize = 25,
  ...rest
}) => {
  const { theme } = useTheme();

  const textDefault = useMemo(() => {
    if (text) {
      return text;
    }
    return SwitchProvidersTextMap[provider];
  }, [provider, text]);

  const uri = useMemo(() => {
    return SwitchProvidersImageMap?.[provider]?.[theme] || '';
  }, [provider, theme]);

  return (
    <Button
      fullWidth
      type="outline"
      appearance="text"
      alignItems="center"
      startContent={<Image width={iconSize} height={iconSize} source={uri} />}
      endContent={<Box width={iconSize} height={iconSize} />}
      sx={{
        text: {
          width: '100%',
          textAlign: 'center',
          alignItems: 'flex-end',
        },
      }}
      {...rest}
    >
      {textDefault}
    </Button>
  );
};
