import { createFileRoute, redirect } from '@tanstack/react-router'
import { useAuthStore } from '@/stores/auth.store'
import { POSRegister } from '@/components/pos/pos-register'

export const Route = createFileRoute('/pos')({
  beforeLoad: () => {
    const { token } = useAuthStore.getState()
    if (!token) {
      throw redirect({ to: '/login' })
    }
  },
  component: POSPage,
})

function POSPage() {
  return (
    <div className="h-screen w-screen overflow-hidden bg-background text-foreground">
      <POSRegister />
    </div>
  )
}
