"""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.add_appointment_request import (
    AddAppointmentRequest,
)
from mindbodypublicapi.models.api_error import (
    ApiError,
)
from mindbodypublicapi.models.appointment import (
    Appointment,
)


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

    Contains information about an appointment creation outcome.

    Attributes:
        appointment (Appointment): Contains information about an appointment.
        error (ApiError): The model property of type ApiError.
        request (AddAppointmentRequest): Represents a request to add a new
            appointment, including details such as client information, appointment
            timing, location, and additional preferences.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "appointment": "Appointment",
        "error": "Error",
        "request": "Request",
    }

    _optionals = [
        "appointment",
        "error",
        "request",
    ]

    def __init__(
        self,
        appointment=APIHelper.SKIP,
        error=APIHelper.SKIP,
        request=APIHelper.SKIP):
        """Initialize a AddAppointmentOutcome instance."""
        # Initialize members of the class
        if appointment is not APIHelper.SKIP:
            self.appointment = appointment
        if error is not APIHelper.SKIP:
            self.error = error
        if request is not APIHelper.SKIP:
            self.request = request

    @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 =\
            Appointment.from_dictionary(
                dictionary.get("Appointment"))\
                if "Appointment" in dictionary.keys()\
                else APIHelper.SKIP
        error =\
            ApiError.from_dictionary(
                dictionary.get("Error"))\
                if "Error" in dictionary.keys()\
                else APIHelper.SKIP
        request =\
            AddAppointmentRequest.from_dictionary(
                dictionary.get("Request"))\
                if "Request" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(appointment,
                   error,
                   request)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _appointment=(
            self.appointment
            if hasattr(self, "appointment")
            else None
        )
        _error=(
            self.error
            if hasattr(self, "error")
            else None
        )
        _request=(
            self.request
            if hasattr(self, "request")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"appointment={_appointment!r}, "
            f"error={_error!r}, "
            f"request={_request!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _appointment=(
            self.appointment
            if hasattr(self, "appointment")
            else None
        )
        _error=(
            self.error
            if hasattr(self, "error")
            else None
        )
        _request=(
            self.request
            if hasattr(self, "request")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"appointment={_appointment!s}, "
            f"error={_error!s}, "
            f"request={_request!s}, "
            f")"
        )
