'use client'

import { redirect } from 'next/navigation'

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

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

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

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

  return <MarketDashboard />
}
