import { db } from './lib/db'

async function checkDatabase() {
  try {
    // Check if admin exists
    const adminCount = await db.admin.count()
    console.log('Admin count:', adminCount)
    
    if (adminCount > 0) {
      const admins = await db.admin.findMany()
      console.log('Admins:', admins)
    }
    
    // Check if polres exists
    const polresCount = await db.polres.count()
    console.log('Polres count:', polresCount)
    
    if (polresCount > 0) {
      const polresList = await db.polres.findMany()
      console.log('Polres:', polresList)
    }
    
    // Check if polsek exists
    const polsekCount = await db.polsek.count()
    console.log('Polsek count:', polsekCount)
    
    if (polsekCount > 0) {
      const polsekList = await db.polsek.findMany({
        include: { polres: true }
      })
      console.log('Polsek:', polsekList)
    }
    
  } catch (error) {
    console.error('Database error:', error)
  } finally {
    process.exit(0)
  }
}

checkDatabase()