import { z } from 'zod';

export const createParticipantSchema = z.object({
  userId: z.string().uuid(),
  userEmail: z.string().email(),
  userName: z.string().min(1),
  participantType: z.enum(['INITIATOR', 'APPROVER', 'SPECTATOR'] as const),
  canComment: z.boolean().optional(),
  canViewDocuments: z.boolean().optional(),
  canDownloadDocuments: z.boolean().optional(),
  notificationEnabled: z.boolean().optional(),
});

export const updateParticipantSchema = z.object({
  canComment: z.boolean().optional(),
  canViewDocuments: z.boolean().optional(),
  canDownloadDocuments: z.boolean().optional(),
  notificationEnabled: z.boolean().optional(),
  isActive: z.boolean().optional(),
});

export const participantParamsSchema = z.object({
  id: z.string().uuid('Invalid workflow ID'),
  participantId: z.string().uuid('Invalid participant ID'),
});

export const validateCreateParticipant = (data: any) => {
  return createParticipantSchema.parse(data);
};

export const validateUpdateParticipant = (data: any) => {
  return updateParticipantSchema.parse(data);
};
