// Removes the SincA WhatsApp Windows service.
// Run from an ELEVATED (Administrator) shell:
//     node service/uninstall-service.js
const path = require('path');
const { Service } = require('node-windows');

const ROOT = path.join(__dirname, '..');

const svc = new Service({
    name: 'SincA WhatsApp Service',
    script: path.join(ROOT, 'main.js'),
});

svc.on('uninstall', () => {
    console.log('✅ Service uninstalled:', svc.exists ? 'still present?' : 'removed.');
});
svc.on('stop', () => console.log('Service stopped.'));
svc.on('error', (err) => console.error('❌ Service error:', err));

console.log('Uninstalling "SincA WhatsApp Service"…');
svc.uninstall();
