"""visaacceptancemergedspec.

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

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


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

    Attributes:
        network (str): PIN Debit Services: Contains the ID of the debit network to
            which the transaction was routed.  | Code | Network | | --- | --- | |
            0000 | Priority Routing or Generic File Update | | 0002 | Visa programs,
            Private Label and non-Visa Authorization Gateway Services | | 0003 |
            Interlink | | 0004 | Plus | | 0008 | Star | | 0009 | Pulse| | 0010 | Star
            | | 0011 | Star | | 0012 | Star (primary network ID) | | 0013 | AFFN | |
            0015 | Star | | 0016 | Maestro | | 0017 | Pulse (primary network ID) | |
            0018 | NYCE (primary network ID) | | 0019 | Pulse | | 0020 | Accel | |
            0023 | NETS | | 0024 | CU24 | | 0025 | Alaska Option | | 0027 | NYCE | |
            0028 | Shazam | | 0029 | EBT POS |  FDC Nashville Global authorization
            service:  Indicates whether the transaction was routed to a credit
            network, a debit network, or the STAR signature debit network. - `C`:
            Credit network - `D`: Debit network (without signature) - `S`: STAR
            signature debit network
        network_name (str): Name of the network to which the transaction was routed.
        customer_signature_required (str): Indicates whether you need to obtain the
            cardholder's signature.  Possible values: - `Y`: You need to obtain the
            cardholder's signature. - `N`: You do not need to obtain the cardholder's
            signature.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "network": "network",
        "network_name": "networkName",
        "customer_signature_required": "customerSignatureRequired",
    }

    _optionals = [
        "network",
        "network_name",
        "customer_signature_required",
    ]

    def __init__(
        self,
        network=APIHelper.SKIP,
        network_name=APIHelper.SKIP,
        customer_signature_required=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Routing instance."""
        # Initialize members of the class
        if network is not APIHelper.SKIP:
            self.network = network
        if network_name is not APIHelper.SKIP:
            self.network_name = network_name
        if customer_signature_required is not APIHelper.SKIP:
            self.customer_signature_required = customer_signature_required

        # 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
        network =\
            dictionary.get("network")\
            if dictionary.get("network")\
                else APIHelper.SKIP
        network_name =\
            dictionary.get("networkName")\
            if dictionary.get("networkName")\
                else APIHelper.SKIP
        customer_signature_required =\
            dictionary.get("customerSignatureRequired")\
            if dictionary.get("customerSignatureRequired")\
                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(network,
                   network_name,
                   customer_signature_required,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _network=(
            self.network
            if hasattr(self, "network")
            else None
        )
        _network_name=(
            self.network_name
            if hasattr(self, "network_name")
            else None
        )
        _customer_signature_required=(
            self.customer_signature_required
            if hasattr(self, "customer_signature_required")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"network={_network!r}, "
            f"network_name={_network_name!r}, "
            f"customer_signature_required={_customer_signature_required!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _network=(
            self.network
            if hasattr(self, "network")
            else None
        )
        _network_name=(
            self.network_name
            if hasattr(self, "network_name")
            else None
        )
        _customer_signature_required=(
            self.customer_signature_required
            if hasattr(self, "customer_signature_required")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"network={_network!s}, "
            f"network_name={_network_name!s}, "
            f"customer_signature_required={_customer_signature_required!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
