import { SnakeToCamel } from "./utils.mjs";
import { AppleIdTokenStrategy, EmailCodeStrategy, EmailLinkStrategy, EnterpriseSSOStrategy, GoogleOneTapStrategy, OAuthStrategy, PhoneCodeStrategy, TicketStrategy, Web3Strategy } from "./strategies.mjs";
import { PhoneCodeChannel } from "./phoneCodeChannel.mjs";
import { VerificationResource } from "./verification.mjs";
import { EmailAddressIdentifier, EmailAddressOrPhoneNumberIdentifier, PhoneNumberIdentifier, UsernameIdentifier, Web3WalletIdentifier } from "./identifiers.mjs";
import { FirstNameAttribute, LastNameAttribute, LegalAcceptedAttribute, PasswordAttribute } from "./attributes.mjs";
import { SignUpVerificationJSONSnapshot, SignUpVerificationsJSONSnapshot } from "./snapshots.mjs";

//#region src/types/signUpCommon.d.ts
/** @inline */
type SignUpStatus = 'missing_requirements' | 'complete' | 'abandoned';
type ProtectCheckField = 'protect_check';
/** @inline */
type SignUpField = SignUpAttributeField | SignUpIdentificationField | ProtectCheckField;
/**
 * A pending Clerk Protect challenge that must be completed before the current sign-in or sign-up attempt can continue.
 *
 * This resource is only returned when Protect mid-flow challenges are enabled for the instance. When present, load the challenge SDK from `sdkUrl`, initialize it with `token` and `uiHints`, and submit the proof token returned by the SDK with `submitProtectCheck()`.
 */
interface ProtectCheckResource {
  /**
   * The current state of the Protect challenge. Protect check resources are only returned while the challenge is waiting to be completed.
   */
  status: 'pending';
  /**
   * An opaque challenge token generated by Clerk. Pass this value unchanged to the Protect challenge SDK.
   */
  token: string;
  /**
   * The URL of the Protect challenge SDK to load for this specific challenge.
   */
  sdkUrl: string;
  /**
   * Unix epoch timestamp, in milliseconds, when the challenge expires and can no longer be completed.
   */
  expiresAt?: number;
  /**
   * Optional Clerk-provided presentation hints. Pass these values through to the Protect challenge SDK as-is.
   */
  uiHints?: Record<string, string>;
}
type PrepareVerificationParams = {
  strategy: EmailCodeStrategy;
} | {
  strategy: EmailLinkStrategy;
  redirectUrl?: string;
} | {
  strategy: PhoneCodeStrategy;
  channel?: PhoneCodeChannel;
} | {
  strategy: Web3Strategy;
} | {
  strategy: OAuthStrategy;
  redirectUrl?: string;
  actionCompleteRedirectUrl?: string;
  oidcPrompt?: string;
  oidcLoginHint?: string;
} | {
  strategy: EnterpriseSSOStrategy;
  redirectUrl?: string;
  actionCompleteRedirectUrl?: string;
};
type AttemptVerificationParams = {
  strategy: EmailCodeStrategy | PhoneCodeStrategy;
  code: string;
} | {
  strategy: Web3Strategy;
  signature: string;
};
/** @inline */
type SignUpAttributeField = FirstNameAttribute | LastNameAttribute | PasswordAttribute | LegalAcceptedAttribute;
/** @inline */
type SignUpVerifiableField = UsernameIdentifier | EmailAddressIdentifier | PhoneNumberIdentifier | EmailAddressOrPhoneNumberIdentifier | Web3WalletIdentifier;
/** @inline */
type SignUpIdentificationField = SignUpVerifiableField | OAuthStrategy | EnterpriseSSOStrategy;
type SignUpCreateParams = Partial<{
  externalAccountStrategy: string;
  externalAccountRedirectUrl: string;
  externalAccountActionCompleteRedirectUrl: string;
  strategy: OAuthStrategy | EnterpriseSSOStrategy | TicketStrategy | GoogleOneTapStrategy | AppleIdTokenStrategy | PhoneCodeStrategy;
  redirectUrl: string;
  actionCompleteRedirectUrl: string;
  transfer: boolean;
  unsafeMetadata: SignUpUnsafeMetadata;
  ticket: string;
  token: string;
  legalAccepted: boolean;
  oidcPrompt: string;
  oidcLoginHint: string;
  channel: PhoneCodeChannel;
  locale?: string;
} & Omit<SnakeToCamel<Record<SignUpAttributeField | SignUpVerifiableField, string>>, 'legalAccepted'>>;
type SignUpUpdateParams = SignUpCreateParams;
/**
 * @deprecated Use `SignUpAuthenticateWithWeb3Params` instead.
 */
type SignUpAuthenticateWithMetamaskParams = SignUpAuthenticateWithWeb3Params;
type SignUpAuthenticateWithWeb3Params = {
  unsafeMetadata?: SignUpUnsafeMetadata;
  legalAccepted?: boolean;
};
type SignUpAuthenticateWithSolanaParams = SignUpAuthenticateWithWeb3Params & {
  walletName: string;
};
interface SignUpVerificationsResource {
  emailAddress: SignUpVerificationResource;
  phoneNumber: SignUpVerificationResource;
  externalAccount: VerificationResource;
  web3Wallet: VerificationResource;
  __internal_toSnapshot: () => SignUpVerificationsJSONSnapshot;
}
interface SignUpVerificationResource extends VerificationResource {
  supportedStrategies: string[];
  nextAction: string;
  __internal_toSnapshot: () => SignUpVerificationJSONSnapshot;
}
//#endregion
export { AttemptVerificationParams, PrepareVerificationParams, ProtectCheckField, ProtectCheckResource, SignUpAttributeField, SignUpAuthenticateWithMetamaskParams, SignUpAuthenticateWithSolanaParams, SignUpAuthenticateWithWeb3Params, SignUpCreateParams, SignUpField, SignUpIdentificationField, SignUpStatus, SignUpUpdateParams, SignUpVerifiableField, SignUpVerificationResource, SignUpVerificationsResource };