"""mindbodypublicapi.

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

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


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

    Attributes:
        appointment_id (int): This is the id of the main appointment we added on to
        add_on_appointment_id (int): This is the id for the newly created add-on
            appointment

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "appointment_id": "AppointmentId",
        "add_on_appointment_id": "AddOnAppointmentId",
    }

    _optionals = [
        "appointment_id",
        "add_on_appointment_id",
    ]

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

    @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
        appointment_id =\
            dictionary.get("AppointmentId")\
            if dictionary.get("AppointmentId")\
                else APIHelper.SKIP
        add_on_appointment_id =\
            dictionary.get("AddOnAppointmentId")\
            if dictionary.get("AddOnAppointmentId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(appointment_id,
                   add_on_appointment_id)

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

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