from typing import Optional

from httpmessageprocessorutil.automapped import auto_map


@auto_map({"system_api_key": {"name": "X-Api-Key", "location": "header", "type": str},
           "pos_id": {"name": "posId", "type": str},
           "print_coupon": {"name": "printCoupon", "type": Optional[str]},
           "print_tef_customer_receipt": {"name": "printTefCustomerReceipt", "type": Optional[str]},
           "order_id": {"name": "orderId", "type": Optional[str]},
           "device_type": {"name": "deviceType", "type": Optional[str]}})
class OrderFinalizeRequest(object):
    def __init__(
        self,
        system_api_key,                         # type: str
        pos_id,                                 # type: str
        print_coupon='True',                    # type: Optional[str]
        print_tef_customer_receipt='False',     # type: Optional[str]
        order_id="",                            # type: Optional[str]
        device_type="",                         # type: Optional[str]
    ):
        # type: (...) -> None

        self.system_api_key = system_api_key
        self.pos_id = pos_id
        self.print_coupon = True if print_coupon is None else print_coupon.lower() == 'true'
        print_receipt = False if print_tef_customer_receipt is None else print_tef_customer_receipt.lower() == 'true'
        self.print_tef_customer_receipt = print_receipt
        self.order_id = order_id
        self.device_type = device_type.upper() if device_type is not None else ""

