import { z } from 'zod';
import { personalLocationSchema, preferredPronounsSchema } from '@/lib/validation';
import type { AccessibilityOptions } from '@/types/location';

/**
 * Schema for accessibility options
 */
export const accessibilityOptionsSchema = z.object({
  font_size: z.enum(['small', 'medium', 'large'] as const),
  high_contrast: z.boolean(),
  reduced_motion: z.boolean()
});

/**
 * Schema for location form data
 */
export const locationFormSchema = z.object({
  personal_location: personalLocationSchema,
  home_park_id: z.string().uuid('Invalid park ID').optional().nullable(),
  timezone: z.string().min(1, 'Timezone is required'),
  preferred_language: z.string().min(2, 'Language code must be at least 2 characters').max(10),
  preferred_pronouns: preferredPronounsSchema
});

/**
 * Default accessibility options for new users
 */
export const DEFAULT_ACCESSIBILITY_OPTIONS: AccessibilityOptions = {
  font_size: 'medium',
  high_contrast: false,
  reduced_motion: false
};

/**
 * Common timezones for selection
 */
export const COMMON_TIMEZONES = [
  'UTC',
  'America/New_York',
  'America/Chicago',
  'America/Denver',
  'America/Los_Angeles',
  'America/Anchorage',
  'America/Toronto',
  'America/Vancouver',
  'America/Mexico_City',
  'America/Sao_Paulo',
  'Europe/London',
  'Europe/Paris',
  'Europe/Berlin',
  'Europe/Madrid',
  'Europe/Rome',
  'Europe/Stockholm',
  'Europe/Moscow',
  'Asia/Dubai',
  'Asia/Kolkata',
  'Asia/Bangkok',
  'Asia/Singapore',
  'Asia/Shanghai',
  'Asia/Tokyo',
  'Asia/Seoul',
  'Australia/Sydney',
  'Australia/Melbourne',
  'Pacific/Auckland'
] as const;

/**
 * Validate park option data
 */
export const parkOptionSchema = z.object({
  id: z.string().uuid(),
  name: z.string(),
  location: z.object({
    city: z.string().optional(),
    state_province: z.string().optional(),
    country: z.string()
  }).optional()
});
