'use client'

import { redirect } from 'next/navigation'

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

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

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

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

  return <MessengerDashboard />
}
