import { objectId } from '@jig-software/zod-bson';
import { z } from 'zod';

export const PasswordHash = z.object({
  hash: z.string(),
  createdAt: z.date(),
});
export type PasswordHash = z.infer<typeof PasswordHash>;

export const User = z.object({
  _id: objectId(),
  name: z.string(),
  username: z.string(),
  email: z.string(),
  passwords: z.array(PasswordHash),
  activated: z.boolean(),
  activationCode: z.string().optional(),
  totpSecret: z.string(),
  mfaEnabled: z.boolean(),
});
export type User = z.infer<typeof User>;
