"""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.client_arrival import (
    ClientArrival,
)
from mindbodypublicapi.models.client_contract import (
    ClientContract,
)
from mindbodypublicapi.models.client_membership import (
    ClientMembership,
)
from mindbodypublicapi.models.client_service import (
    ClientService,
)
from mindbodypublicapi.models.client_with_suspension_info import (
    ClientWithSuspensionInfo,
)


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

    Contains information about the requested client.

    Attributes:
        client (ClientWithSuspensionInfo): A Client DTO with Suspension Informatoin
        client_services (List[ClientService]): Contains information about client
            pricing options.
        client_contracts (List[ClientContract]): Contains information about client
            contract.
        client_memberships (List[ClientMembership]): Contains information about
            client Memberships.
        client_arrivals (List[ClientArrival]): Contains information about client
            arrival services.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client": "Client",
        "client_services": "ClientServices",
        "client_contracts": "ClientContracts",
        "client_memberships": "ClientMemberships",
        "client_arrivals": "ClientArrivals",
    }

    _optionals = [
        "client",
        "client_services",
        "client_contracts",
        "client_memberships",
        "client_arrivals",
    ]

    def __init__(
        self,
        client=APIHelper.SKIP,
        client_services=APIHelper.SKIP,
        client_contracts=APIHelper.SKIP,
        client_memberships=APIHelper.SKIP,
        client_arrivals=APIHelper.SKIP):
        """Initialize a GetClientCompleteInfoResponse instance."""
        # Initialize members of the class
        if client is not APIHelper.SKIP:
            self.client = client
        if client_services is not APIHelper.SKIP:
            self.client_services = client_services
        if client_contracts is not APIHelper.SKIP:
            self.client_contracts = client_contracts
        if client_memberships is not APIHelper.SKIP:
            self.client_memberships = client_memberships
        if client_arrivals is not APIHelper.SKIP:
            self.client_arrivals = client_arrivals

    @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
        client =\
            ClientWithSuspensionInfo.from_dictionary(
                dictionary.get("Client"))\
                if "Client" in dictionary.keys()\
                else APIHelper.SKIP
        client_services = None
        if dictionary.get("ClientServices") is not None:
            client_services = [
                ClientService.from_dictionary(x)
                    for x in dictionary.get("ClientServices")
            ]
        else:
            client_services = APIHelper.SKIP
        client_contracts = None
        if dictionary.get("ClientContracts") is not None:
            client_contracts = [
                ClientContract.from_dictionary(x)
                    for x in dictionary.get("ClientContracts")
            ]
        else:
            client_contracts = APIHelper.SKIP
        client_memberships = None
        if dictionary.get("ClientMemberships") is not None:
            client_memberships = [
                ClientMembership.from_dictionary(x)
                    for x in dictionary.get("ClientMemberships")
            ]
        else:
            client_memberships = APIHelper.SKIP
        client_arrivals = None
        if dictionary.get("ClientArrivals") is not None:
            client_arrivals = [
                ClientArrival.from_dictionary(x)
                    for x in dictionary.get("ClientArrivals")
            ]
        else:
            client_arrivals = APIHelper.SKIP

        # Return an object of this model
        return cls(client,
                   client_services,
                   client_contracts,
                   client_memberships,
                   client_arrivals)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client=(
            self.client
            if hasattr(self, "client")
            else None
        )
        _client_services=(
            self.client_services
            if hasattr(self, "client_services")
            else None
        )
        _client_contracts=(
            self.client_contracts
            if hasattr(self, "client_contracts")
            else None
        )
        _client_memberships=(
            self.client_memberships
            if hasattr(self, "client_memberships")
            else None
        )
        _client_arrivals=(
            self.client_arrivals
            if hasattr(self, "client_arrivals")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client={_client!r}, "
            f"client_services={_client_services!r}, "
            f"client_contracts={_client_contracts!r}, "
            f"client_memberships={_client_memberships!r}, "
            f"client_arrivals={_client_arrivals!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client=(
            self.client
            if hasattr(self, "client")
            else None
        )
        _client_services=(
            self.client_services
            if hasattr(self, "client_services")
            else None
        )
        _client_contracts=(
            self.client_contracts
            if hasattr(self, "client_contracts")
            else None
        )
        _client_memberships=(
            self.client_memberships
            if hasattr(self, "client_memberships")
            else None
        )
        _client_arrivals=(
            self.client_arrivals
            if hasattr(self, "client_arrivals")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client={_client!s}, "
            f"client_services={_client_services!s}, "
            f"client_contracts={_client_contracts!s}, "
            f"client_memberships={_client_memberships!s}, "
            f"client_arrivals={_client_arrivals!s}, "
            f")"
        )
