'use client' import { useState, useEffect } from 'react' import { Button } from '@/components/ui/button' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { BookingConfirmation } from '@/components/kiosk/BookingConfirmation' import { WalkInFlow } from '@/components/kiosk/WalkInFlow' import { Calendar, UserPlus, MapPin, Clock } from 'lucide-react' /** @description Kiosk interface component for location-based check-in confirmations and walk-in booking creation. */ export default function KioskPage({ params }: { params: { locationId: string } }) { const [apiKey, setApiKey] = useState(null) const [location, setLocation] = useState(null) const [currentView, setCurrentView] = useState<'home' | 'confirm' | 'walkin'>('home') const [loading, setLoading] = useState(true) const [error, setError] = useState(null) const [currentTime, setCurrentTime] = useState(new Date()) useEffect(() => { const timer = setInterval(() => { setCurrentTime(new Date()) }, 1000) return () => clearInterval(timer) }, []) useEffect(() => { const authenticateKiosk = async () => { setLoading(true) setError(null) try { const response = await fetch('/api/kiosk/authenticate', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ api_key: process.env.NEXT_PUBLIC_KIOSK_API_KEY || 'demo-api-key-64-characters-long-enough' }) }) const data = await response.json() if (!response.ok) { throw new Error(data.error || 'Authentication failed') } setApiKey(data.kiosk.device_name) setLocation(data.kiosk.location) } catch (err) { setError(err instanceof Error ? err.message : 'Error de autenticación del kiosko') } finally { setLoading(false) } } authenticateKiosk() }, []) const formatDateTime = (date: Date) => { return new Intl.DateTimeFormat('es-MX', { dateStyle: 'full', timeStyle: 'short', timeZone: location?.timezone || 'America/Monterrey' }).format(date) } if (loading) { return (

Iniciando kiosko...

) } if (error) { return (
Error de Conexión
{error}
) } if (currentView === 'confirm') { return (
{ setCurrentView('home') }} onCancel={() => setCurrentView('home')} />
) } if (currentView === 'walkin') { return (
{ setCurrentView('home') }} onCancel={() => setCurrentView('home')} />
) } return (

{location?.name || 'Kiosko'}

Kiosko Principal
{formatDateTime(currentTime)}

ID del Kiosko

{apiKey || 'N/A'}

setCurrentView('confirm')} >
Confirmar Cita Confirma tu llegada ingresando el código de tu cita
setCurrentView('walkin')} >
Reserva Inmediata Crea una reserva sin cita previa (Walk-in)
Instrucciones

Confirmar Cita

  1. Selecciona "Confirmar Cita"
  2. Ingresa el código de 6 caracteres de tu reserva
  3. Verifica los detalles de tu cita
  4. Confirma tu llegada

Reserva Inmediata

  1. Selecciona "Reserva Inmediata"
  2. Elige el servicio que deseas
  3. Ingresa tus datos personales
  4. Confirma la reserva
) }