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

"""
paypalserversdk

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


class OrderUpdateCallbackErrorResponseDetails(object):

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

    The error details. Required for client-side `4XX` errors.

    Attributes:
        field (str): The field that caused the error. If this field is in the
            body, set this value to the field's JSON pointer value. Required
            for client-side errors.
        value (str): The value of the field that caused the error.
        issue (str): The unique, fine-grained application-level error code.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "issue": 'issue',
        "field": 'field',
        "value": 'value'
    }

    _optionals = [
        'field',
        'value',
    ]

    def __init__(self,
                 issue=None,
                 field=APIHelper.SKIP,
                 value=APIHelper.SKIP):
        """Constructor for the OrderUpdateCallbackErrorResponseDetails class"""

        # Initialize members of the class
        if field is not APIHelper.SKIP:
            self.field = field 
        if value is not APIHelper.SKIP:
            self.value = value 
        self.issue = issue 

    @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
        issue = dictionary.get("issue") if dictionary.get("issue") else None
        field = dictionary.get("field") if dictionary.get("field") else APIHelper.SKIP
        value = dictionary.get("value") if dictionary.get("value") else APIHelper.SKIP
        # Return an object of this model
        return cls(issue,
                   field,
                   value)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'field={(self.field if hasattr(self, "field") else None)!r}, '
                f'value={(self.value if hasattr(self, "value") else None)!r}, '
                f'issue={self.issue!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'field={(self.field if hasattr(self, "field") else None)!s}, '
                f'value={(self.value if hasattr(self, "value") else None)!s}, '
                f'issue={self.issue!s})')
