const fs = require('fs');

const map1 = {
  'https://images.unsplash.com/photo-1579684385127-1ef15d508118?auto=format&fit=crop&q=80&w=800': '../Assets/expert.jpg',
  'https://images.unsplash.com/photo-1519494026892-80bbd2d6fd0d?auto=format&fit=crop&q=80&w=800': '../Assets/affordability.jpg',
  'https://images.unsplash.com/photo-1581594693702-fbdc51b2763b?auto=format&fit=crop&q=80&w=800': '../Assets/equipment.jpg'
};

const map2 = {
  'https://images.unsplash.com/photo-1519494026892-80bbd2d6fd0d?auto=format&fit=crop&q=80&w=800': '../../Assets/affordability.jpg',
  'https://images.unsplash.com/photo-1581594693702-fbdc51b2763b?auto=format&fit=crop&q=80&w=800': '../../Assets/equipment.jpg'
};

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');
