"""mindbodypublicapi.

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

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


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

    ReturnSaleResponse

    Attributes:
        return_sale_id (int): The returned sale ID
        trainer_id (int): The trainer ID who returned the sale
        amount (float): The returned amount

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "return_sale_id": "ReturnSaleID",
        "trainer_id": "TrainerID",
        "amount": "Amount",
    }

    _optionals = [
        "return_sale_id",
        "trainer_id",
        "amount",
    ]

    def __init__(
        self,
        return_sale_id=APIHelper.SKIP,
        trainer_id=APIHelper.SKIP,
        amount=APIHelper.SKIP):
        """Initialize a ReturnSaleResponse instance."""
        # Initialize members of the class
        if return_sale_id is not APIHelper.SKIP:
            self.return_sale_id = return_sale_id
        if trainer_id is not APIHelper.SKIP:
            self.trainer_id = trainer_id
        if amount is not APIHelper.SKIP:
            self.amount = amount

    @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
        return_sale_id =\
            dictionary.get("ReturnSaleID")\
            if dictionary.get("ReturnSaleID")\
                else APIHelper.SKIP
        trainer_id =\
            dictionary.get("TrainerID")\
            if dictionary.get("TrainerID")\
                else APIHelper.SKIP
        amount =\
            dictionary.get("Amount")\
            if dictionary.get("Amount")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(return_sale_id,
                   trainer_id,
                   amount)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _return_sale_id=(
            self.return_sale_id
            if hasattr(self, "return_sale_id")
            else None
        )
        _trainer_id=(
            self.trainer_id
            if hasattr(self, "trainer_id")
            else None
        )
        _amount=(
            self.amount
            if hasattr(self, "amount")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"return_sale_id={_return_sale_id!r}, "
            f"trainer_id={_trainer_id!r}, "
            f"amount={_amount!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _return_sale_id=(
            self.return_sale_id
            if hasattr(self, "return_sale_id")
            else None
        )
        _trainer_id=(
            self.trainer_id
            if hasattr(self, "trainer_id")
            else None
        )
        _amount=(
            self.amount
            if hasattr(self, "amount")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"return_sale_id={_return_sale_id!s}, "
            f"trainer_id={_trainer_id!s}, "
            f"amount={_amount!s}, "
            f")"
        )
