import * as z from 'zod';
import { BUSINESS_ROLES } from '@/lib/auth/rbac';

export const userSchema = z.object({
  name: z.string().min(2, 'Name must be at least 2 characters'),
  email: z.string().email('Please enter a valid email'),
  password: z.string().optional(),
  systemRole: z.enum(['super_admin', 'user']),
  memberships: z
    .array(
      z.object({
        organizationId: z.string().min(1),
        membershipRole: z.enum(['admin', 'user']),
        businessRole: z.enum(BUSINESS_ROLES)
      })
    )
    .min(1, 'Select at least one organization')
});

export type UserFormValues = z.infer<typeof userSchema>;
