"""mindbodypublicapi.

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

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


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

    Creates an add-on for an appointment

    Attributes:
        apply_payment (bool): When `true`, indicates that a payment should be applied
            to the appointment. Currently only ApplyPayment=false is implemented.
            Default: **true**
        appointment_id (int): The appointment ID the add-on is getting added to.
        session_type_id (int): The session type associated with the new appointment
            add-on.
        staff_id (int): The ID of the staff member who is adding the new appointment
            add-on.  Default: staff member performing the appointment.
        test (bool): When `true`, indicates that the method is to be validated, but
            no new appointment add-on data is added.  Default: **false**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "apply_payment": "ApplyPayment",
        "appointment_id": "AppointmentId",
        "session_type_id": "SessionTypeId",
        "staff_id": "StaffId",
        "test": "Test",
    }

    _optionals = [
        "apply_payment",
        "appointment_id",
        "session_type_id",
        "staff_id",
        "test",
    ]

    def __init__(
        self,
        apply_payment=APIHelper.SKIP,
        appointment_id=APIHelper.SKIP,
        session_type_id=APIHelper.SKIP,
        staff_id=APIHelper.SKIP,
        test=APIHelper.SKIP):
        """Initialize a AddAppointmentAddOnRequest instance."""
        # Initialize members of the class
        if apply_payment is not APIHelper.SKIP:
            self.apply_payment = apply_payment
        if appointment_id is not APIHelper.SKIP:
            self.appointment_id = appointment_id
        if session_type_id is not APIHelper.SKIP:
            self.session_type_id = session_type_id
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if test is not APIHelper.SKIP:
            self.test = test

    @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
        apply_payment =\
            dictionary.get("ApplyPayment")\
            if "ApplyPayment" in dictionary.keys()\
                else APIHelper.SKIP
        appointment_id =\
            dictionary.get("AppointmentId")\
            if dictionary.get("AppointmentId")\
                else APIHelper.SKIP
        session_type_id =\
            dictionary.get("SessionTypeId")\
            if dictionary.get("SessionTypeId")\
                else APIHelper.SKIP
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(apply_payment,
                   appointment_id,
                   session_type_id,
                   staff_id,
                   test)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _apply_payment=(
            self.apply_payment
            if hasattr(self, "apply_payment")
            else None
        )
        _appointment_id=(
            self.appointment_id
            if hasattr(self, "appointment_id")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"apply_payment={_apply_payment!r}, "
            f"appointment_id={_appointment_id!r}, "
            f"session_type_id={_session_type_id!r}, "
            f"staff_id={_staff_id!r}, "
            f"test={_test!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _apply_payment=(
            self.apply_payment
            if hasattr(self, "apply_payment")
            else None
        )
        _appointment_id=(
            self.appointment_id
            if hasattr(self, "appointment_id")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"apply_payment={_apply_payment!s}, "
            f"appointment_id={_appointment_id!s}, "
            f"session_type_id={_session_type_id!s}, "
            f"staff_id={_staff_id!s}, "
            f"test={_test!s}, "
            f")"
        )
