import { NextResponse } from 'next/server'

// POST - Verify admin password
export async function POST(request: Request) {
  try {
    const body = await request.json()
    const { password } = body

    // Get password from environment variable
    const adminPassword = process.env.ADMIN_PASSWORD || 'admin123'

    if (password === adminPassword) {
      return NextResponse.json({ success: true })
    } else {
      return NextResponse.json({ success: false, error: 'Password salah!' }, { status: 401 })
    }
  } catch (error) {
    console.error('Error verifying password:', error)
    return NextResponse.json({ success: false, error: 'Terjadi kesalahan' }, { status: 500 })
  }
}
