from pos_model import Order
from typing import Dict

from _ContextKeys import ContextKeys
from _NfceXmlPartBuilder import NfceXmlPartBuilder
from common import InfAdicBuilderCommon
from ibpttaxprocessor import IbptTaxProcessor


class InfAdicBuilder(NfceXmlPartBuilder):

    def __init__(
        self,                       # type: str
        customer_text_field,        # type: str
        tax_builder,                # type: IbptTaxProcessor
        coupon_fiscal_parameters,   # type: Dict[str, bool]
    ):
        # type: (...) -> None

        self.customer_text_field = customer_text_field
        self.tax_builder = tax_builder
        self.coupon_fiscal_parameters = coupon_fiscal_parameters

    def build_xml(
        self,       # type: InfAdicBuilder
        order,      # type: Order
        context,    # type: ContextKeys
    ):
        # type: (...) -> unicode

        inf_adic_builder_common = InfAdicBuilderCommon(
            order=order,
            customer_text_field=self.customer_text_field,
            tax_builder=self.tax_builder,
            coupon_fiscal_parameters=self.coupon_fiscal_parameters,
        )
        return inf_adic_builder_common.build_common()
