import { z } from "zod";

export const loginSchema = z.object({
  email: z.string().email(),
  password: z.string().min(8),
});

export const registerSchema = z.object({
  full_name: z.string().min(2).max(120),
  email: z.string().email(),
  password: z.string().min(12),
  role: z.enum(["admin", "chair", "member", "secretary", "advisor"]),
  committee_id: z.number().int().nullable().optional(),
});

export const loginSecondFactorSchema = z.object({
  login_token: z.string().min(10),
  totp_code: z.string().regex(/^\d{6}$/).optional(),
});

export const totpVerifySchema = z.object({
  token: z.string().regex(/^\d{6}$/),
});

export const webauthnFinishSchema = z.object({
  credential: z.any(),
});
