"""visaacceptancemergedspec.

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

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


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

    Attributes:
        factor_codes (List[str]): The model property of type List[str].
        model_used (str): Name of the score model used for the transaction. If you
            did not include a custom model in your request, this field contains the
            name of Visa Acceptance’s default model.  For all possible values, see
            the `score_model_used` field description in the _Decision Manager Using
            the SCMP API Developer Guide_ on the [Visa Acceptance Business Center.](
            Click **Decision Manager** > **Documentation** > **Guides** > _Decision
            Manager Using the SCMP API Developer Guide_ (PDF link).
        result (str): Total score calculated for this order. The value cannot be
            negative.  For all possible values, see the `score_score_result` field
            description in the _Decision Manager Using the SCMP API Developer Guide_
            on the [Visa Acceptance Business Center.]( Click **Decision Manager** >
            **Documentation** > **Guides** > _Decision Manager Using the SCMP API
            Developer Guide_ (PDF link).
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "factor_codes": "factorCodes",
        "model_used": "modelUsed",
        "result": "result",
    }

    _optionals = [
        "factor_codes",
        "model_used",
        "result",
    ]

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

        # 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
        factor_codes =\
            dictionary.get("factorCodes")\
            if dictionary.get("factorCodes")\
                else APIHelper.SKIP
        model_used =\
            dictionary.get("modelUsed")\
            if dictionary.get("modelUsed")\
                else APIHelper.SKIP
        result =\
            dictionary.get("result")\
            if dictionary.get("result")\
                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(factor_codes,
                   model_used,
                   result,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _factor_codes=(
            self.factor_codes
            if hasattr(self, "factor_codes")
            else None
        )
        _model_used=(
            self.model_used
            if hasattr(self, "model_used")
            else None
        )
        _result=(
            self.result
            if hasattr(self, "result")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"factor_codes={_factor_codes!r}, "
            f"model_used={_model_used!r}, "
            f"result={_result!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _factor_codes=(
            self.factor_codes
            if hasattr(self, "factor_codes")
            else None
        )
        _model_used=(
            self.model_used
            if hasattr(self, "model_used")
            else None
        )
        _result=(
            self.result
            if hasattr(self, "result")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"factor_codes={_factor_codes!s}, "
            f"model_used={_model_used!s}, "
            f"result={_result!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
