require('dotenv').config()
const items = require('./items')
const output = require('./output');

(async () => {
  for (const item of items) {
    console.log(`Looking at ${item.name}`)

    let partsPrice = 0
    for (const part of item.parts) {
      partsPrice += await part.getPrice()
    }

    const setPrice = await item.set.getPrice()
    if (partsPrice < setPrice) {
      output.addItem(item.name, partsPrice, setPrice)
    }
  }

  output.submit()
})()
