import z from "https://deno.land/x/zod@v3.21.4/index.ts";
import { createSchema } from "@lib/db/createSchema.ts";

const UserSchema = z.object({
  id: z.string().optional().default(() => crypto.randomUUID()),
  createdAt: z.date().default(() => new Date()),
  email: z.string().email(),
  name: z.string(),
});
export const userDB = createSchema("user", UserSchema);

const SessionSchema = z.object({
  id: z.string().default(() => crypto.randomUUID()),
  createdAt: z.date().default(() => new Date()),
  expiresAt: z.date().default(() => new Date()),
  userId: z.string(),
});
export const sessionDB = createSchema("session", SessionSchema);
