"""visaacceptancemergedspec.

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

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


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

    Attributes:
        stored_credential_used (bool): Indicates to an issuing bank whether a
            merchant-initiated transaction came from a card that was already stored
            on file.  Possible values: - **true** means the merchant-initiated
            transaction came from a card that was already stored on file. - **false**
            means the merchant-initiated transaction came from a card that was not
            stored on file.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "stored_credential_used": "storedCredentialUsed",
    }

    _optionals = [
        "stored_credential_used",
    ]

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

        # 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
        stored_credential_used =\
            dictionary.get("storedCredentialUsed")\
            if "storedCredentialUsed" in dictionary.keys()\
                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(stored_credential_used,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _stored_credential_used=(
            self.stored_credential_used
            if hasattr(self, "stored_credential_used")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"stored_credential_used={_stored_credential_used!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _stored_credential_used=(
            self.stored_credential_used
            if hasattr(self, "stored_credential_used")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"stored_credential_used={_stored_credential_used!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
