import { syncCatalog } from '../src/lib/sync/catalog-sync-service';
import { db } from '../src/db/client';

async function testSync() {
  const shop = await db.getDefaultShop();
  const catalogs = await db.getCatalogs(shop?.id || '');
  console.log('Catalogs:', catalogs.map(c => ({ id: c.id, name: c.name, fb_catalog_id: c.fb_catalog_id })));

  if (catalogs.length > 0) {
    const targetCat = catalogs[0];
    console.log('Syncing catalog:', targetCat.id, targetCat.fb_catalog_id);
    const res = await syncCatalog(targetCat.id);
    console.log('Sync result:', JSON.stringify(res, null, 2));
  }
}

testSync().catch(console.error);
