"use client"

import { useSession } from "next-auth/react"

export function useAuth() {
  const { data: session, status } = useSession()

  return {
    session,
    user: session?.user,
    role: session?.user?.role,
    isAdmin: session?.user?.role === "ADMIN",
    isStaff: session?.user?.role === "STAFF",
    isMember: session?.user?.role === "MEMBER",
    isPreventionOfficer: session?.user?.role === "PREVENTION_OFFICER",
    isAuthenticated: status === "authenticated",
    isLoading: status === "loading",
    hasError: !!session?.error,
    error: session?.error,
  }
}
