import Dexie from 'dexie'

/**
 * Local IndexedDB snapshot — written by SSE events and full GETs.
 * Read-only in Emergency Mode when the server is unreachable.
 */
const db = new Dexie('pos_snapshot')

db.version(1).stores({
  tables:  'id, group_id, is_active',       // TableOut snapshots
  orders:  'id, table_id, status',           // ActiveOrderSlim + OrderOut snapshots
  offline_payments: '++localId, uuid, synced', // queued emergency payments
})

export default db
