input: Write a python function to generate an invoice from a given order using the Invoice class.
  assert Invoice([Order('item1', 2, 10), Order('item2', 1, 20)]).generate_invoice() == {'subtotal': 40, 'tax_rate': 0.15, 'tax_amount': 6.0, 'total_amount': 46.0}
  assert Invoice([Order('item1', 3, 15)]).generate_invoice() == {'subtotal': 45, 'tax_rate': 0.15, 'tax_amount': 6.75, 'total_amount': 51.75}
  assert Invoice([Order('item1', 1, 100), Order('item2', 2, 50)]).generate_invoice() == {'subtotal': 200, 'tax_rate': 0.15, 'tax_amount': 30.0, 'total_amount': 230.0}
output: class Order:
      def __init__(self, item_name, quantity, price_per_item):
          self.item_name = item_name
          self.quantity = quantity
          self.price_per_item = price_per_item
  
  class Invoice:
      def __init__(self, orders, tax_rate=0.15):
          self.orders = orders
          self.tax_rate = tax_rate
  
      def generate_invoice(self):
          subtotal = sum(order.quantity * order.price_per_item for order in self.orders)
          tax_amount = subtotal * self.tax_rate
          total_amount = subtotal + tax_amount
          return {
              'subtotal': subtotal,
              'tax_rate': self.tax_rate,
              'tax_amount': tax_amount,
              'total_amount': total_amount
          }