import { db } from './src/lib/db';

async function updateServiceIcons() {
  try {
    // Update services with appropriate icons
    const updates = [
      {
        id: 'cmgwlh8jt0001t6yotypc18ii', // SPKT
        iconFile: '/uploads/1760475239665-Icon (1).png' // Red icon for SPKT
      },
      {
        id: 'cmgwlh8ju0003t6yo1vmejt39', // Lalu Lintas
        iconFile: '/uploads/1760475247493-Icon (3).png' // Blue icon for Lalu Lintas
      },
      {
        id: 'cmgwlh8jv0005t6yo5w6cv6k5', // SKCK
        iconFile: '/uploads/1760475234526-Icon (2).png' // Black/red icon for SKCK
      },
      {
        id: 'cmgwlh8jw0007t6yopb1nsmj9', // Live Chat
        iconFile: '/uploads/1760810161422-Icon__3_.png' // Green icon for Live Chat
      }
    ];

    for (const update of updates) {
      await db.serviceLink.update({
        where: { id: update.id },
        data: { iconFile: update.iconFile }
      });
      console.log(`Updated icon for service ID: ${update.id}`);
    }

    console.log('All service icons updated successfully!');

    // Verify updates
    const services = await db.serviceLink.findMany({
      where: { parentId: null },
      select: { id: true, title: true, iconFile: true }
    });

    console.log('\n=== UPDATED SERVICES ===');
    services.forEach(service => {
      console.log(`${service.title}: ${service.iconFile}`);
    });

  } catch (error) {
    console.error('Error updating service icons:', error);
  } finally {
    await db.$disconnect();
  }
}

updateServiceIcons();