"""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.copy_credit_card_response_client import (
    CopyCreditCardResponseClient,
)


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

    crosssite/copycreditcard

    Attributes:
        copied_from (CopyCreditCardResponseClient): The model property of type
            CopyCreditCardResponseClient.
        copied_to (CopyCreditCardResponseClient): The model property of type
            CopyCreditCardResponseClient.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "copied_from": "CopiedFrom",
        "copied_to": "CopiedTo",
    }

    _optionals = [
        "copied_from",
        "copied_to",
    ]

    def __init__(
        self,
        copied_from=APIHelper.SKIP,
        copied_to=APIHelper.SKIP):
        """Initialize a CopyCreditCardResponse instance."""
        # Initialize members of the class
        if copied_from is not APIHelper.SKIP:
            self.copied_from = copied_from
        if copied_to is not APIHelper.SKIP:
            self.copied_to = copied_to

    @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
        copied_from =\
            CopyCreditCardResponseClient.from_dictionary(
                dictionary.get("CopiedFrom"))\
                if "CopiedFrom" in dictionary.keys()\
                else APIHelper.SKIP
        copied_to =\
            CopyCreditCardResponseClient.from_dictionary(
                dictionary.get("CopiedTo"))\
                if "CopiedTo" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(copied_from,
                   copied_to)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _copied_from=(
            self.copied_from
            if hasattr(self, "copied_from")
            else None
        )
        _copied_to=(
            self.copied_to
            if hasattr(self, "copied_to")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"copied_from={_copied_from!r}, "
            f"copied_to={_copied_to!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _copied_from=(
            self.copied_from
            if hasattr(self, "copied_from")
            else None
        )
        _copied_to=(
            self.copied_to
            if hasattr(self, "copied_to")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"copied_from={_copied_from!s}, "
            f"copied_to={_copied_to!s}, "
            f")"
        )
