import "./style.pcss";

import type { FC, ReactElement } from "react";
import type { ICaptcha } from "./config/types";
import type { IComponentBaseProps } from "../../types/components/index";
import { useCN } from "../../utils/react/useCN";

/**
 * Компонент каптчи
 * @returns {ReactElement}
 */
const Captcha: FC<ICaptcha & IComponentBaseProps> = ({
  baseClass = "captcha",
  extraClasses = {},
  extraAttrs = {},
  children = null,
  siteKey,
  theme,
}): ReactElement => {

  const { getCN } = useCN(baseClass);

  return (
    <div data-js-google-captcha={""} data-sitekey={siteKey} data-theme={theme} className={getCN("", extraClasses)} {...extraAttrs}>
      {children}
    </div>
  );

};

export type {
  ICaptcha,
};

export {
  Captcha,
};
