"""cellpointapi.

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

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


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

    Provider that performed the fraud assessment.

    Attributes:
        name (str): Name of the fraud provider.
        external_id (str): Provider's identifier for the fraud assessment.
        external_status (str): Provider's status for the fraud assessment.
        external_code (str): Provider's response code for the fraud assessment.
        external_description (str): Details provided by the provider about the result.
        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",
        "external_id": "externalId",
        "external_status": "externalStatus",
        "external_code": "externalCode",
        "external_description": "externalDescription",
    }

    _optionals = [
        "name",
        "external_id",
        "external_status",
        "external_code",
        "external_description",
    ]

    def __init__(
        self,
        name=APIHelper.SKIP,
        external_id=APIHelper.SKIP,
        external_status=APIHelper.SKIP,
        external_code=APIHelper.SKIP,
        external_description=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Provider instance."""
        # Initialize members of the class
        if name is not APIHelper.SKIP:
            self.name = name
        if external_id is not APIHelper.SKIP:
            self.external_id = external_id
        if external_status is not APIHelper.SKIP:
            self.external_status = external_status
        if external_code is not APIHelper.SKIP:
            self.external_code = external_code
        if external_description is not APIHelper.SKIP:
            self.external_description = external_description

        # 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
        external_id =\
            dictionary.get("externalId")\
            if dictionary.get("externalId")\
                else APIHelper.SKIP
        external_status =\
            dictionary.get("externalStatus")\
            if dictionary.get("externalStatus")\
                else APIHelper.SKIP
        external_code =\
            dictionary.get("externalCode")\
            if dictionary.get("externalCode")\
                else APIHelper.SKIP
        external_description =\
            dictionary.get("externalDescription")\
            if dictionary.get("externalDescription")\
                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,
                   external_id,
                   external_status,
                   external_code,
                   external_description,
                   additional_properties)

    @classmethod
    def validate(cls, dictionary):
        """Validate dictionary against class required properties

        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:
            boolean : if dictionary is valid contains required properties.

        """
        if isinstance(dictionary, cls):
            return True

        if not isinstance(dictionary, dict):
            return False

        return True

    def __repr__(self):
        """Return a unambiguous string representation."""
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _external_id=(
            self.external_id
            if hasattr(self, "external_id")
            else None
        )
        _external_status=(
            self.external_status
            if hasattr(self, "external_status")
            else None
        )
        _external_code=(
            self.external_code
            if hasattr(self, "external_code")
            else None
        )
        _external_description=(
            self.external_description
            if hasattr(self, "external_description")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!r}, "
            f"external_id={_external_id!r}, "
            f"external_status={_external_status!r}, "
            f"external_code={_external_code!r}, "
            f"external_description={_external_description!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
        )
        _external_id=(
            self.external_id
            if hasattr(self, "external_id")
            else None
        )
        _external_status=(
            self.external_status
            if hasattr(self, "external_status")
            else None
        )
        _external_code=(
            self.external_code
            if hasattr(self, "external_code")
            else None
        )
        _external_description=(
            self.external_description
            if hasattr(self, "external_description")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"name={_name!s}, "
            f"external_id={_external_id!s}, "
            f"external_status={_external_status!s}, "
            f"external_code={_external_code!s}, "
            f"external_description={_external_description!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
