'use client'

import { redirect } from 'next/navigation'

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

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

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

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

  return <MarketDashboard />
}
