'use client'

import { redirect } from 'next/navigation'

import { useAuthContext } from '@/contexts/AuthContext'

import { MessengerDashboard } from './messenger-dashboard'

export function SellerMessenger() {
  const { user } = useAuthContext()

  // Дополнительная защита на уровне компонента
  if (user?.organization?.type !== 'SELLER') {
    console.error('Security violation: wrong role in SellerMessenger')
    redirect('/login')
  }

  return <MessengerDashboard />
}
