from production.box import HideOptionBox
from production.treebuilder import BoxConfiguration

from ._BoxBuilder import BoxBuilder


class HideOptionBoxBuilder(BoxBuilder):
    def __init__(self, product_repository, loggers):
        super(HideOptionBoxBuilder, self).__init__(loggers)
        self.product_repository = product_repository

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

        inherit_comments = self.get_extra(config, "InheritComments", "false").lower() == "true"
        return HideOptionBox(
            name=config.name,
            sons=config.sons,
            fix_default_qty=self.get_extra(config, "FixDefaultQuantity", "false").lower() == "true",
            inherit_comments=inherit_comments,
            logger=self.get_logger(config),
        )
