import { NextResponse } from 'next/server'; import { dataService } from '@/lib/data-service'; export async function POST(request: Request) { try { const { identifier } = await request.json(); if (!identifier) { return NextResponse.json({ success: false, error: 'Identificador no proporcionado' }, { status: 400 }); } const user = dataService.authenticate(identifier); if (!user) { return NextResponse.json({ success: false, error: 'Usuario no encontrado' }, { status: 404 }); } if (!user.isActive) { return NextResponse.json({ success: false, error: 'Cuenta inactiva' }, { status: 403 }); } dataService.updateUser(user.id, { lastLogin: 'Biometría (Huella/Face ID)' }); return NextResponse.json({ success: true, message: 'Autenticación biométrica exitosa', user, }); } catch (error: any) { return NextResponse.json({ success: false, error: error.message }, { status: 500 }); } }