import React from 'react'
import { Scheduling } from './components/Scheduling'
import type { User } from './services/supabase'

interface AppProps {
  user?: User
  currentRoute?: string
}

export default function App(props: AppProps) {
  // Get user and route from props or try to get from window (for standalone testing)
  const user = props.user || (window as any).__SCHEDULING_USER__
  const currentRoute = props.currentRoute || window.location.pathname

  if (!user) {
    return (
      <div className="p-6">
        <div className="bg-yellow-50 border border-yellow-200 rounded-md p-4">
          <div className="text-sm text-yellow-700">
            User information is required to use the scheduling module. Please ensure you are logged in.
          </div>
        </div>
      </div>
    )
  }

  return <Scheduling user={user} currentRoute={currentRoute} />
}

