"""mindbodypublicapi.

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

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


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

    ReturnSaleRequest

    Attributes:
        sale_id (int): The Sale ID of the sale item to be returned.
        return_reason (str): The reason for the return.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "sale_id": "SaleId",
        "return_reason": "ReturnReason",
    }

    _optionals = [
        "sale_id",
        "return_reason",
    ]

    def __init__(
        self,
        sale_id=APIHelper.SKIP,
        return_reason=APIHelper.SKIP):
        """Initialize a ReturnSaleRequest instance."""
        # Initialize members of the class
        if sale_id is not APIHelper.SKIP:
            self.sale_id = sale_id
        if return_reason is not APIHelper.SKIP:
            self.return_reason = return_reason

    @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
        sale_id =\
            dictionary.get("SaleId")\
            if dictionary.get("SaleId")\
                else APIHelper.SKIP
        return_reason =\
            dictionary.get("ReturnReason")\
            if dictionary.get("ReturnReason")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(sale_id,
                   return_reason)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _sale_id=(
            self.sale_id
            if hasattr(self, "sale_id")
            else None
        )
        _return_reason=(
            self.return_reason
            if hasattr(self, "return_reason")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"sale_id={_sale_id!r}, "
            f"return_reason={_return_reason!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _sale_id=(
            self.sale_id
            if hasattr(self, "sale_id")
            else None
        )
        _return_reason=(
            self.return_reason
            if hasattr(self, "return_reason")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"sale_id={_sale_id!s}, "
            f"return_reason={_return_reason!s}, "
            f")"
        )
