from production.treebuilder import BoxConfiguration

from ._BoxBuilder import BoxBuilder
from production.box import AddAllItemsTagBox


class AddAllItemsTagBoxBuilder(BoxBuilder):
    def __init__(self, order_changer, loggers):
        super(AddAllItemsTagBoxBuilder, self).__init__(loggers)
        self.order_changer = order_changer

    def build(
        self,
        config,     # type: BoxConfiguration
    ):
        # type: (...) -> AddAllItemsTagBox

        return AddAllItemsTagBox(
            name=config.name,
            sons=config.sons,
            tag=self.get_extra(config, "Tag", None),
            order_changer=self.order_changer,
            logger=self.get_logger(config)
        )
