"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.sale import Sale


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

    Update Sale Date Response Properties

    Attributes:
        sale (Sale): Contains the Sale details.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "sale": "Sale",
    }

    _optionals = [
        "sale",
    ]

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

    @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 =\
            Sale.from_dictionary(
                dictionary.get("Sale"))\
                if "Sale" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(sale)

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

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