import { PrismaAdapter } from '@lucia-auth/adapter-prisma'
import { Lucia } from 'lucia'
import prisma from '../prisma/client'

export const auth = new Lucia<object, { username: string, displayName: string }>(new PrismaAdapter(prisma.session, prisma.user))

// export const auth = new Lucia({
//   adapter: new PrismaAdapter(prisma.session, prisma.user),
//   env: process.env.NODE_ENV === 'production' ? 'PROD' : 'DEV',
//   middleware: req => ({
//     headers: req.headers,
//   }),
//   transformUserData: user => ({
//     id: user.id,
//     username: user.username,
//     displayName: user.username,
//   }),
// })

export type Auth = typeof auth
