"""cellpointapi.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper


class VoucherConfig(object):
    """Implementation of the 'VoucherConfig' model.

    Configuration for Voucher.

    Attributes:
        issuer (str): Issuer of the voucher
        max_vouchers (int): The maximum number of vouchers that can be used for this
            order.
        max_amount (int): The maximum amount that can be authorized with voucher in
            this order. In most cases, this is the total amount of "PACKAGE"
            authorization group on the order.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "issuer": "issuer",
        "max_vouchers": "maxVouchers",
        "max_amount": "maxAmount",
    }

    _optionals = [
        "max_amount",
    ]

    def __init__(
        self,
        max_vouchers=None,
        max_amount=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a VoucherConfig instance."""
        # Initialize members of the class
        self.issuer = "SWAV_PAYMENT_GATEWAY"
        self.max_vouchers = max_vouchers
        if max_amount is not APIHelper.SKIP:
            self.max_amount = max_amount

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        max_vouchers =\
            dictionary.get("maxVouchers")\
            if dictionary.get("maxVouchers")\
                else None
        max_amount =\
            dictionary.get("maxAmount")\
            if dictionary.get("maxAmount")\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(max_vouchers,
                   max_amount,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _issuer=self.issuer
        _max_vouchers=self.max_vouchers
        _max_amount=(
            self.max_amount
            if hasattr(self, "max_amount")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"issuer={_issuer!r}, "
            f"max_vouchers={_max_vouchers!r}, "
            f"max_amount={_max_amount!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _issuer=self.issuer
        _max_vouchers=self.max_vouchers
        _max_amount=(
            self.max_amount
            if hasattr(self, "max_amount")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"issuer={_issuer!s}, "
            f"max_vouchers={_max_vouchers!s}, "
            f"max_amount={_max_amount!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
