import type { CaptchaProvider } from "../types.ts";

export function defineCaptchaProvider<T extends CaptchaProvider>(provider: T): T {
  if (!provider.name) throw new TypeError("Custom CAPTCHA provider requires a stable name");
  if (!provider.client?.responseField)
    throw new TypeError("Custom CAPTCHA provider requires client.responseField");
  if (typeof provider.verify !== "function")
    throw new TypeError("Custom CAPTCHA provider requires verify()");
  return provider;
}
