"""mindbodypublicapi.

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

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


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

    Attributes:
        barcode_id (str): The gift card's barcode ID.
        remaining_balance (float): The gift card's remaining balance.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "barcode_id": "BarcodeId",
        "remaining_balance": "RemainingBalance",
    }

    _optionals = [
        "barcode_id",
        "remaining_balance",
    ]

    def __init__(
        self,
        barcode_id=APIHelper.SKIP,
        remaining_balance=APIHelper.SKIP):
        """Initialize a GetGiftCardBalanceResponse instance."""
        # Initialize members of the class
        if barcode_id is not APIHelper.SKIP:
            self.barcode_id = barcode_id
        if remaining_balance is not APIHelper.SKIP:
            self.remaining_balance = remaining_balance

    @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
        barcode_id =\
            dictionary.get("BarcodeId")\
            if dictionary.get("BarcodeId")\
                else APIHelper.SKIP
        remaining_balance =\
            dictionary.get("RemainingBalance")\
            if dictionary.get("RemainingBalance")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(barcode_id,
                   remaining_balance)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _remaining_balance=(
            self.remaining_balance
            if hasattr(self, "remaining_balance")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"barcode_id={_barcode_id!r}, "
            f"remaining_balance={_remaining_balance!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _remaining_balance=(
            self.remaining_balance
            if hasattr(self, "remaining_balance")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"barcode_id={_barcode_id!s}, "
            f"remaining_balance={_remaining_balance!s}, "
            f")"
        )
