// Fassade: lädt nur den per STORE_DRIVER gewählten Treiber (sqlite|directus).
let _p;
function drv() {
  if (!_p) _p = (process.env.STORE_DRIVER === 'directus') ? import('./store-directus.js') : import('./store-sqlite.js');
  return _p;
}
export const driverName = () => (process.env.STORE_DRIVER === 'directus' ? 'directus' : 'sqlite');
export const listProducts     = async ()        => (await drv()).listProducts();
export const getProductBySlug = async (s)        => (await drv()).getProductBySlug(s);
export const getProductById   = async (id)       => (await drv()).getProductById(id);
export const createProduct    = async (d)        => (await drv()).createProduct(d);
export const updateProduct    = async (id, d)    => (await drv()).updateProduct(id, d);
export const deleteProduct    = async (id)       => (await drv()).deleteProduct(id);
export const listOrders       = async ()         => (await drv()).listOrders();
export const getOrderById     = async (id)       => (await drv()).getOrderById(id);
export const createOrder      = async (o)        => (await drv()).createOrder(o);
export const updateOrderStatus= async (id, s)    => (await drv()).updateOrderStatus(id, s);
export const listCustomers    = async ()         => (await drv()).listCustomers();
export const getCustomerById  = async (id)       => (await drv()).getCustomerById(id);
export const dashboard        = async ()         => (await drv()).dashboard();
