'use client'

import { redirect } from 'next/navigation'

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

import { MarketDashboard } from './market-dashboard'

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

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

  return <MarketDashboard />
}
