import { DefaultSession, DefaultUser } from 'next-auth'
import { DefaultJWT } from '@auth/core/jwt'
import { StaffRole } from '@prisma/client'

declare module 'next-auth' {
  interface User extends DefaultUser {
    userType: 'customer' | 'staff'
    role?: StaffRole
    company?: string | null
    subscription?: {
      id: string
      plan: string
      tier: string
      status: string
    } | null
    // 2FA support
    twoFactorEnabled?: boolean
  }

  interface Session extends DefaultSession {
    user: User & {
      id: string
      email: string
      name?: string | null
    }
  }
}

declare module '@auth/core/jwt' {
  interface JWT extends DefaultJWT {
    id: string
    userType: 'customer' | 'staff'
    role?: StaffRole
    company?: string | null
    subscription?: {
      id: string
      plan: string
      tier: string
      status: string
    } | null
    // 2FA support
    twoFactorEnabled?: boolean
  }
}
