"""mindbodypublicapi.

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

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


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

    Attributes:
        id (int): The ID of this add-on.
        name (str): The name of this add-on.
        num_deducted (int): The number of sessions that this add-on deducts from the
            pricing option used to pay for this add-on.
        category_id (int): This ID of this add-on’s category.
        category (str): The name of this add-on’s category.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "Id",
        "name": "Name",
        "num_deducted": "NumDeducted",
        "category_id": "CategoryId",
        "category": "Category",
    }

    _optionals = [
        "id",
        "name",
        "num_deducted",
        "category_id",
        "category",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        name=APIHelper.SKIP,
        num_deducted=APIHelper.SKIP,
        category_id=APIHelper.SKIP,
        category=APIHelper.SKIP):
        """Initialize a AppointmentAddOn instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if name is not APIHelper.SKIP:
            self.name = name
        if num_deducted is not APIHelper.SKIP:
            self.num_deducted = num_deducted
        if category_id is not APIHelper.SKIP:
            self.category_id = category_id
        if category is not APIHelper.SKIP:
            self.category = category

    @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
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        name =\
            dictionary.get("Name")\
            if dictionary.get("Name")\
                else APIHelper.SKIP
        num_deducted =\
            dictionary.get("NumDeducted")\
            if dictionary.get("NumDeducted")\
                else APIHelper.SKIP
        category_id =\
            dictionary.get("CategoryId")\
            if dictionary.get("CategoryId")\
                else APIHelper.SKIP
        category =\
            dictionary.get("Category")\
            if dictionary.get("Category")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(id,
                   name,
                   num_deducted,
                   category_id,
                   category)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _num_deducted=(
            self.num_deducted
            if hasattr(self, "num_deducted")
            else None
        )
        _category_id=(
            self.category_id
            if hasattr(self, "category_id")
            else None
        )
        _category=(
            self.category
            if hasattr(self, "category")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"name={_name!r}, "
            f"num_deducted={_num_deducted!r}, "
            f"category_id={_category_id!r}, "
            f"category={_category!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _num_deducted=(
            self.num_deducted
            if hasattr(self, "num_deducted")
            else None
        )
        _category_id=(
            self.category_id
            if hasattr(self, "category_id")
            else None
        )
        _category=(
            self.category
            if hasattr(self, "category")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"name={_name!s}, "
            f"num_deducted={_num_deducted!s}, "
            f"category_id={_category_id!s}, "
            f"category={_category!s}, "
            f")"
        )
