const fs = require('fs');

const map1 = {
  'https://images.unsplash.com/photo-1559757175-9b165fb14f9d?auto=format&fit=crop&q=80&w=800': '../Assets/ultrasound.png',
  'https://images.unsplash.com/photo-1579154204601-01588f351e67?auto=format&fit=crop&q=80&w=800': '../Assets/blood-testing.png',
  'https://images.unsplash.com/photo-1516064715622-c423ed95c378?auto=format&fit=crop&q=80&w=800': '../Assets/X-ray.png',
  'https://images.unsplash.com/photo-1595064085577-7c2ef98ec311?auto=format&fit=crop&q=80&w=800': '../Assets/pregnancy-scans.png',
  'https://images.unsplash.com/photo-1505751172876-fa1923c5c528?auto=format&fit=crop&q=80&w=800': '../Assets/Cardiac-Package.png',
  'https://images.unsplash.com/photo-1576091160399-112ba8d25d1d?auto=format&fit=crop&q=80&w=800': '../Assets/ECG.png',
  'https://images.unsplash.com/photo-1559757175-5700fc52b7b2?auto=format&fit=crop&q=80&w=800': '../Assets/Echocardiogram.png',
  'https://images.unsplash.com/photo-1582719471384-894fbb16e074?auto=format&fit=crop&q=80&w=800': '../Assets/PFT.png',
  'https://images.unsplash.com/photo-1518133526084-5f532a76f264?auto=format&fit=crop&q=80&w=800': '../Assets/allergy-testing.png',
  'https://images.unsplash.com/photo-1532938911079-1b06ac7ce122?auto=format&fit=crop&q=80&w=800': '../Assets/Preventive-Health-Checkup.png'
};

const map2 = {
  'https://images.unsplash.com/photo-1559757175-9b165fb14f9d?auto=format&fit=crop&q=80&w=800': '../../Assets/ultrasound.png',
  'https://images.unsplash.com/photo-1579154204601-01588f351e67?auto=format&fit=crop&q=80&w=800': '../../Assets/blood-testing.png',
  'https://images.unsplash.com/photo-1516064715622-c423ed95c378?auto=format&fit=crop&q=80&w=800': '../../Assets/X-ray.png',
  'https://images.unsplash.com/photo-1595064085577-7c2ef98ec311?auto=format&fit=crop&q=80&w=800': '../../Assets/pregnancy-scans.png',
  'https://images.unsplash.com/photo-1505751172876-fa1923c5c528?auto=format&fit=crop&q=80&w=800': '../../Assets/Cardiac-Package.png',
  'https://images.unsplash.com/photo-1576091160399-112ba8d25d1d?auto=format&fit=crop&q=80&w=800': '../../Assets/ECG.png',
  'https://images.unsplash.com/photo-1559757175-5700fc52b7b2?auto=format&fit=crop&q=80&w=800': '../../Assets/Echocardiogram.png',
  'https://images.unsplash.com/photo-1582719471384-894fbb16e074?auto=format&fit=crop&q=80&w=800': '../../Assets/PFT.png',
  'https://images.unsplash.com/photo-1518133526084-5f532a76f264?auto=format&fit=crop&q=80&w=800': '../../Assets/allergy-testing.png',
  'https://images.unsplash.com/photo-1532938911079-1b06ac7ce122?auto=format&fit=crop&q=80&w=800': '../../Assets/Preventive-Health-Checkup.png'
};

let indexContent = fs.readFileSync('index.html', 'utf8');
for (const [k, v] of Object.entries(map1)) {
    indexContent = indexContent.split(k).join(v);
}
fs.writeFileSync('index.html', indexContent);

let genContent = fs.readFileSync('generate.js', 'utf8');
for (const [k, v] of Object.entries(map2)) {
    genContent = genContent.split(k).join(v);
}
fs.writeFileSync('generate.js', genContent);
console.log('Update Complete');
