"""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.reservation import (
    Reservation,
)
from mindbodypublicapi.models.response_details import (
    ResponseDetails,
)


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

    Contains information about the create reservation response.

    Attributes:
        reservation (Reservation): Contains information about the reservation.
        response_details (ResponseDetails): Contains information about the response
            message detail.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reservation": "Reservation",
        "response_details": "ResponseDetails",
    }

    _optionals = [
        "reservation",
        "response_details",
    ]

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

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

        # Return an object of this model
        return cls(reservation,
                   response_details)

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

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