import ReCAPTCHA, { ReCAPTCHAProps } from "react-google-recaptcha"

const GOOGLE_RECAPTCHA_KEY = process.env.NEXT_PUBLIC_RECAPTCHA_GOOGLE || ''

export interface ReCaptchaProps extends Omit<ReCAPTCHAProps, 'sitekey'> {
  sitekey?: string;
}

export const ReCaptcha = (props: ReCaptchaProps) => {
  const { sitekey, ...rest } = props

  return (
    <ReCAPTCHA sitekey={sitekey || GOOGLE_RECAPTCHA_KEY} {...rest} />
  )
}
