"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


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

    Attributes:
        name (str): Name of the service provider that is collecting the service fee.
            The service provider name must consist of 3, 7, or 12 characters followed
            by an asterisk (*). This value must also include the words “Service Fee.”
            When you include more than one consecutive space, extra spaces are
            removed. Use one of the following formats for this value: - <3-character
            name>*Service Fee - <7-character name>*Service Fee - <12-character
            name>*Service Fee  When payments are made in installments, this value
            must also include installment information such as “1 of 5” or “3 of 7.”
            For installment payments, use one of the following formats for this
            value: - <3-character name>*Service Fee*<N> of <M> - <7-character
            name>*Service Fee*<N> of <M> - <12-character name>*Service Fee*<N> of <M>
            where <N> is the payment number and <M> is the total number of payments.
            When you do not include this value in your request, Visa Acceptance uses
            the value that is in your Visa Acceptance account.  This value might be
            displayed on the cardholder’s statement.
        contact (str): Contact information for the service provider that is
            collecting the service fee. when you include more than one consecutive
            space, extra spaces are removed.  When you do not include this value in
            your request, Visa Acceptance uses the value that is in your Visa
            Acceptance account.  This value might be displayed on the cardholder’s
            statement.
        state (str): State or territory in which the service provider is located.
            When you do not include this value in your request, Visa Acceptance uses
            the value that is in your Visa Acceptance account.  This value might be
            displayed on the cardholder’s statement.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": "name",
        "contact": "contact",
        "state": "state",
    }

    _optionals = [
        "name",
        "contact",
        "state",
    ]

    def __init__(
        self,
        name=APIHelper.SKIP,
        contact=APIHelper.SKIP,
        state=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ServiceFeeDescriptor instance."""
        # Initialize members of the class
        if name is not APIHelper.SKIP:
            self.name = name
        if contact is not APIHelper.SKIP:
            self.contact = contact
        if state is not APIHelper.SKIP:
            self.state = state

        # 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
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else APIHelper.SKIP
        contact =\
            dictionary.get("contact")\
            if dictionary.get("contact")\
                else APIHelper.SKIP
        state =\
            dictionary.get("state")\
            if dictionary.get("state")\
                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(name,
                   contact,
                   state,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _contact=(
            self.contact
            if hasattr(self, "contact")
            else None
        )
        _state=(
            self.state
            if hasattr(self, "state")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!r}, "
            f"contact={_contact!r}, "
            f"state={_state!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _contact=(
            self.contact
            if hasattr(self, "contact")
            else None
        )
        _state=(
            self.state
            if hasattr(self, "state")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!s}, "
            f"contact={_contact!s}, "
            f"state={_state!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
