import { z } from 'zod';

// --- Friendship schemas ---

export const sendFriendRequestSchema = z.object({
  userId: z.string().cuid(),
});

export const friendsPaginationSchema = z.object({
  page: z.coerce.number().int().min(1).default(1),
  limit: z.coerce.number().int().min(1).max(100).default(20),
});

// --- Privacy schemas ---

export const privacyUpdateSchema = z.object({
  showOnlineStatus: z.boolean().optional(),
  showCurrentlyWatching: z.boolean().optional(),
  showInFriendActivity: z.boolean().optional(),
  anonymizePublicComments: z.boolean().optional(),
  hidePublicReactions: z.boolean().optional(),
  hidePublicFinishes: z.boolean().optional(),
  allowFriendRequests: z.boolean().optional(),
  closeFriendsOnlyWatching: z.boolean().optional(),
});

// --- Notification schemas ---

export const notificationsPaginationSchema = z.object({
  page: z.coerce.number().int().min(1).default(1),
  limit: z.coerce.number().int().min(1).max(50).default(20),
  unreadOnly: z.coerce.boolean().default(false),
});

export const notificationPreferencesUpdateSchema = z.object({
  enableFriendRequests: z.boolean().optional(),
  enableComments: z.boolean().optional(),
  enableLikes: z.boolean().optional(),
  enableAchievements: z.boolean().optional(),
  enableSystemNotifications: z.boolean().optional(),
  enableUploadStatus: z.boolean().optional(),
  emailNotifications: z.boolean().optional(),
  digestFrequency: z.enum(['none', 'daily', 'weekly']).optional(),
});

// --- Type exports ---

export type SendFriendRequestInput = z.infer<typeof sendFriendRequestSchema>;
export type FriendsPaginationInput = z.infer<typeof friendsPaginationSchema>;
export type PrivacyUpdateInput = z.infer<typeof privacyUpdateSchema>;
