# -*- coding: utf-8 -*-

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.order_update_callback_error_response_details import OrderUpdateCallbackErrorResponseDetails


class OrderUpdateCallbackErrorResponse(object):

    """Implementation of the 'Order Update Callback Error Response' model.

    The error details.

    Attributes:
        name (str): The human-readable, unique name of the error.
        message (str): The message that describes the error.
        details (List[OrderUpdateCallbackErrorResponseDetails]): An array of
            additional details about the error.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name": 'name',
        "message": 'message',
        "details": 'details'
    }

    _optionals = [
        'message',
        'details',
    ]

    def __init__(self,
                 name=None,
                 message=APIHelper.SKIP,
                 details=APIHelper.SKIP):
        """Constructor for the OrderUpdateCallbackErrorResponse class"""

        # Initialize members of the class
        self.name = name 
        if message is not APIHelper.SKIP:
            self.message = message 
        if details is not APIHelper.SKIP:
            self.details = details 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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 None
        message = dictionary.get("message") if dictionary.get("message") else APIHelper.SKIP
        details = None
        if dictionary.get('details') is not None:
            details = [OrderUpdateCallbackErrorResponseDetails.from_dictionary(x) for x in dictionary.get('details')]
        else:
            details = APIHelper.SKIP
        # Return an object of this model
        return cls(name,
                   message,
                   details)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'name={self.name!r}, '
                f'message={(self.message if hasattr(self, "message") else None)!r}, '
                f'details={(self.details if hasattr(self, "details") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'name={self.name!s}, '
                f'message={(self.message if hasattr(self, "message") else None)!s}, '
                f'details={(self.details if hasattr(self, "details") else None)!s})')
