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

import { z } from 'zod';

export const savePreferencesSchema = z.object({
  unitSystem: z.enum(['imperial', 'metric'], {
    errorMap: () => ({ message: 'Unit system must be either "imperial" or "metric"' })
  }),
  currencyCode: z.string()
    .length(3, 'Currency code must be exactly 3 characters (ISO 4217)')
    .toUpperCase()
    .regex(/^[A-Z]{3}$/, 'Currency code must be 3 uppercase letters'),
  timeZone: z.string()
    .min(1, 'Time zone is required')
    .max(100, 'Time zone must not exceed 100 characters')
}).strict();

export type SavePreferencesInput = z.infer<typeof savePreferencesSchema>;
