"""mindbodypublicapi.

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

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


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

    An appointment option name/value pair

    Attributes:
        display_name (str): The name displayed for this appointment option.
        name (str): The name given to this option.
        value (str): The value of the option.
        mtype (str): The data type of the option value.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "display_name": "DisplayName",
        "name": "Name",
        "value": "Value",
        "mtype": "Type",
    }

    _optionals = [
        "display_name",
        "name",
        "value",
        "mtype",
    ]

    def __init__(
        self,
        display_name=APIHelper.SKIP,
        name=APIHelper.SKIP,
        value=APIHelper.SKIP,
        mtype=APIHelper.SKIP):
        """Initialize a AppointmentOption instance."""
        # Initialize members of the class
        if display_name is not APIHelper.SKIP:
            self.display_name = display_name
        if name is not APIHelper.SKIP:
            self.name = name
        if value is not APIHelper.SKIP:
            self.value = value
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype

    @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
        display_name =\
            dictionary.get("DisplayName")\
            if dictionary.get("DisplayName")\
                else APIHelper.SKIP
        name =\
            dictionary.get("Name")\
            if dictionary.get("Name")\
                else APIHelper.SKIP
        value =\
            dictionary.get("Value")\
            if dictionary.get("Value")\
                else APIHelper.SKIP
        mtype =\
            dictionary.get("Type")\
            if dictionary.get("Type")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(display_name,
                   name,
                   value,
                   mtype)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _display_name=(
            self.display_name
            if hasattr(self, "display_name")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _value=(
            self.value
            if hasattr(self, "value")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"display_name={_display_name!r}, "
            f"name={_name!r}, "
            f"value={_value!r}, "
            f"mtype={_mtype!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _display_name=(
            self.display_name
            if hasattr(self, "display_name")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _value=(
            self.value
            if hasattr(self, "value")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"display_name={_display_name!s}, "
            f"name={_name!s}, "
            f"value={_value!s}, "
            f"mtype={_mtype!s}, "
            f")"
        )
