import { NextResponse } from "next/server"
import { validateAdminPassword, getAdminToken } from "@/lib/admin-auth"

export async function POST(request: Request) {
  const body = await request.json()
  const { password } = body

  if (!password || !validateAdminPassword(password)) {
    return NextResponse.json({ error: "Invalid password" }, { status: 401 })
  }

  return NextResponse.json({ success: true, token: getAdminToken() })
}
