from production.box import ProductionBox


class OrderSpreaderBox(ProductionBox):
    def __init__(self, name, sons, logger=None):
        super(OrderSpreaderBox, self).__init__(name, sons, logger)

    def order_modified(self, order):
        for son in self.sons:
            try:
                self.debug("\n#region    - Order ID: {} - Son BOX: {} @ {}\n", order.order_id, son.name, son.tree_name)
                son.order_modified(order.clone())
            finally:
                self.debug("\n#endregion - Order ID: {} - Son BOX: {} @ {}\n", order.order_id, son.name, son.tree_name)
