import type { UseFormReturn } from 'react-hook-form';
import type { z } from 'zod';
import type { signupEmailFormSchema, signupForeignFormSchema, signupPhoneFormSchema } from '../../validations';
/** Signup mode: phone, email as second field, or foreign (full name + email + phone). */
export type SignupEntryMode = 'phone' | 'email' | 'foreign';
/** Form values for phone-based signup, inferred from the Zod schema. */
export type SignupPhoneFormValues = z.infer<typeof signupPhoneFormSchema>;
/** Form values for email-based signup, inferred from the Zod schema. */
export type SignupEmailFormValues = z.infer<typeof signupEmailFormSchema>;
/** Form values for foreign signup (full name + email + phone), inferred from the Zod schema. */
export type SignupForeignFormValues = z.infer<typeof signupForeignFormSchema>;
/** Discriminated union of all signup form value shapes. */
export type SignupFormValues = SignupPhoneFormValues | SignupEmailFormValues | SignupForeignFormValues;
/** Payload when signup form is valid. */
export type SignupSubmitData = {
    fullName: string;
    phone?: string;
    email?: string;
    countryCode?: string;
};
export interface UseSignupFormOptions {
    /** Mode: phone, email as second field, or foreign (name + email + phone) */
    mode: SignupEntryMode;
    /** For foreign mode: pre-fill phone when user already entered it. */
    defaultPhone?: string | undefined;
    /** Sync callback with valid data. Use when parent owns API (e.g. AuthFlow). Ignored when submitApi is provided. */
    onSubmit?: ((data: SignupSubmitData) => void) | undefined;
    /** When provided, hook runs: validate → submitApi(data) → onSuccess(). Consumer passes redirect in onSuccess. */
    submitApi?: ((data: SignupSubmitData) => Promise<void>) | undefined;
    /** Called after submitApi succeeds (e.g. router.push('/otp') or next step). */
    onSuccess?: (() => void) | undefined;
    /** Called when submitApi rejects or throws. */
    onError?: ((error: unknown) => void) | undefined;
}
/** Return value of the `useSignupForm` hook, providing form state and mode flags. */
export interface UseSignupFormReturn {
    /** react-hook-form methods bound to the current signup mode's schema. */
    methods: UseFormReturn<SignupFormValues>;
    /** Submit handler to pass to the form's `onSubmit`. Validates and dispatches signup data. */
    handleSubmit: (data: SignupFormValues) => void;
    /** True when mode is 'phone', false when mode is 'email'. For 'foreign' same as (mode === 'phone') for layout. */
    isPhone: boolean;
    /** True when mode is 'foreign' (full name + email + phone). */
    isForeign: boolean;
    /** True when current form values pass validation (for disabling Continue – edge cases 9, 16, 19). */
    isFormValid: (data: SignupFormValues) => boolean;
    /** True while submitApi is in flight. */
    isSubmitting: boolean;
}
