// GET /api/printers - Listar todas las impresoras
import { getAllPrinters, getSelectedPrinter } from '../../utils/printers'

export default defineEventHandler(async () => {
  try {
    const printers = await getAllPrinters()
    const selected = await getSelectedPrinter()

    return {
      ok: true,
      printers,
      selectedPrinterId: selected?.id || null
    }
  } catch (err: any) {
    return {
      ok: false,
      error: err.message
    }
  }
})
