// lib/types/next-auth.d.ts
import { Role } from "@prisma/client"
import "next-auth"
import "next-auth/jwt"

declare module "next-auth" {
  interface Session {
    user: {
      id: string
      name: string
      email: string
      role: Role
      avatar?: string
      workspaces: {
        asEmployee: Array<{
          id: string
          slug: string
          managerId: string
        }>
        asManager: Array<{
          id: string
          slug: string
          employeeId: string
        }>
      }
    }
  }

  interface User {
    id: string
    name: string
    email: string
    role: Role
    avatar?: string
  }
}

declare module "next-auth/jwt" {
  interface JWT {
    id: string
    role: Role
    workspaces?: {
      asEmployee: Array<{
        id: string
        slug: string
        managerId: string
      }>
      asManager: Array<{
        id: string
        slug: string
        employeeId: string
      }>
    }
  }
}

