const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('./database/ashtransfer.db');

console.log('🚗 Updating vehicles with 2025 Mercedes model images...\n');

// Official 2025 Mercedes model images from search results
const vehicleImages = {
  'Mercedes E-Class': 'https://sspark.genspark.ai/cfimages?u1=boRHHWEKJwQdEEGJS%2FqsB8oj92OIZ4OM7dia8MFaBecVZRpDAh5RaN%2F7VtS5aFqMq2YXaMy%2BO9pbHRxoAp3giGROjFPTZi2jQ4i3%2BTFbsSmzue34O70hCEjXZS%2BiFovnTGCmvxx1%2BfecpG4O0BO%2BSoM1aViSNJ17g0qyh3Og&u2=XWH2%2F8no0IFWa7kd&width=2560',
  'Mercedes S-Class': 'https://sspark.genspark.ai/cfimages?u1=DF9DPe864GgMKC8IPvALAGIJRfvcQvz6dqYnFkF2Ceufo98DPx2LO%2FFEoJcAP%2FxR3s6%2FQkJdQtd2HhOAXOX2emAv974pgMWTXr%2BrIWXL0f2HX8HVWOUDmsrxrpOf7dZvaR0ndkk5MPeQgaUR%2BktqKcIbUJY0G0Fm8GKkICG%2Fq%2F9%2FFkr%2Fm%2Fb9WLFc&u2=3zTAoSoBqfrBEXoc&width=2560',
  'Mercedes V-Class': 'https://sspark.genspark.ai/cfimages?u1=Rk5J7CY4DC33FniejY1SQCGhwGxwlVa%2BLN%2F8K2QFMSRVhHzoLKhIQyzXUbqyAVgf0nsRq7k6MvAZJI1Rrlqxbmb%2BJ0oheQScYPhzN6%2FI7NorrcmgxWMeycM%2F5zKg&u2=cXGWk0SHY9AG0uCd&width=2560',
  'Mercedes Sprinter': 'https://sspark.genspark.ai/cfimages?u1=GNRgT4GyJmXNcDoKC54DoCKWbd8c2WJKhoLy0q4Wos8amE%2Bt6fPMkErGk95GGgPbfy%2FlHddpu8xIGOS2sm%2BVmBlpRqZ8UNfx8xM1LelHzP%2Bj04csx99%2BcRJ3gR%2B2%2FRQpcJA16zsSit8%3D&u2=Max%2BcVgiSgcPq4t7&width=2560',
  'Standard Saloon': 'https://images.unsplash.com/photo-1494976388531-d1058494cdd8?w=600&h=400&fit=crop',
  'Estate Car': 'https://images.unsplash.com/photo-1552519507-da3b142c6e3d?w=600&h=400&fit=crop'
};

const stmt = db.prepare('UPDATE cms_vehicles SET image_url = ? WHERE name = ?');

Object.entries(vehicleImages).forEach(([name, url]) => {
  stmt.run(url, name);
  console.log(`✓ Updated ${name}`);
  if (name.startsWith('Mercedes')) {
    console.log(`  → 2025 Mercedes model image`);
  }
});

stmt.finalize();

db.close(() => {
  console.log('\n🎉 All vehicle images updated with 2025 Mercedes models!');
  console.log('\n📸 Image Sources:');
  console.log('  • Mercedes E-Class 2025 - Official dealer image');
  console.log('  • Mercedes S-Class 2025 - Official luxury sedan');
  console.log('  • Mercedes V-Class 2025 - MPV people carrier');
  console.log('  • Mercedes Sprinter 2025 - Passenger van/minibus');
  console.log('  • Standard/Estate - Generic luxury sedans');
});
