from logging import Logger
from typing import Dict

from production.box import FilterDeletedItemsNotSentToKitchenBox
from production.treebuilder import BoxConfiguration

from ._BoxBuilder import BoxBuilder


class FilterDeletedItemsNotSentToKitchenBoxBuilder(BoxBuilder):

    def __init__(
        self,       # type: FilterDeletedItemsNotSentToKitchenBoxBuilder
        loggers,    # type: Dict[str, Logger]
    ):
        super(FilterDeletedItemsNotSentToKitchenBoxBuilder, self).__init__(loggers)

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

        return FilterDeletedItemsNotSentToKitchenBox(
            name=config.name,
            sons=config.sons,
            state_to_delete_voided_items=config.extra_config.get("StateToNoSentToKitchen"),
            logger=self.get_logger(config=config),
        )
