"""mindbodypublicapi.

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

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


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

    Attributes:
        commission_type (str): The type of commission earned. Possible values are:  *
            ItemStandardPercentageCommission  * ItemStandardFlatCommission  *
            ItemPromotionalPercentageCommission  * ItemPromotionalFlatCommission  *
            StaffStandardPercentageCommission  * StaffStandardFlatCommission  *
            StaffPromotionalPercentageCommission  * StaffPromotionalFlatCommission
        commission_earnings (float): The portion of `Earnings` earned by this
            `CommissionType`.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "commission_type": "CommissionType",
        "commission_earnings": "CommissionEarnings",
    }

    _optionals = [
        "commission_type",
        "commission_earnings",
    ]

    def __init__(
        self,
        commission_type=APIHelper.SKIP,
        commission_earnings=APIHelper.SKIP):
        """Initialize a CommissionDetail instance."""
        # Initialize members of the class
        if commission_type is not APIHelper.SKIP:
            self.commission_type = commission_type
        if commission_earnings is not APIHelper.SKIP:
            self.commission_earnings = commission_earnings

    @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
        commission_type =\
            dictionary.get("CommissionType")\
            if dictionary.get("CommissionType")\
                else APIHelper.SKIP
        commission_earnings =\
            dictionary.get("CommissionEarnings")\
            if dictionary.get("CommissionEarnings")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(commission_type,
                   commission_earnings)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _commission_type=(
            self.commission_type
            if hasattr(self, "commission_type")
            else None
        )
        _commission_earnings=(
            self.commission_earnings
            if hasattr(self, "commission_earnings")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"commission_type={_commission_type!r}, "
            f"commission_earnings={_commission_earnings!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _commission_type=(
            self.commission_type
            if hasattr(self, "commission_type")
            else None
        )
        _commission_earnings=(
            self.commission_earnings
            if hasattr(self, "commission_earnings")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"commission_type={_commission_type!s}, "
            f"commission_earnings={_commission_earnings!s}, "
            f")"
        )
