/**
 * @ai-summary Request validation schemas for auth API
 * @ai-context Uses Zod for runtime validation and type safety
 */

import { z } from 'zod';

// Password requirements:
// - Minimum 8 characters
// - At least one uppercase letter
// - At least one number
const passwordSchema = z
  .string()
  .min(8, 'Password must be at least 8 characters long')
  .regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
  .regex(/[0-9]/, 'Password must contain at least one number');

export const signupSchema = z.object({
  email: z.string().email('Invalid email format'),
  password: passwordSchema,
  termsAccepted: z.literal(true, {
    errorMap: () => ({ message: 'You must agree to the Terms & Conditions to create an account' }),
  }),
});

export type SignupInput = z.infer<typeof signupSchema>;

// Schema for public resend verification endpoint (no JWT required)
export const resendVerificationPublicSchema = z.object({
  email: z.string().email('Invalid email format'),
});

export type ResendVerificationPublicInput = z.infer<typeof resendVerificationPublicSchema>;
