"""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_with_suspension_info import (
    ClientWithSuspensionInfo,
)


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

    Attributes:
        client (ClientWithSuspensionInfo): A Client DTO with Suspension Informatoin
        test (bool): When `true`, indicates that test mode is enabled. The method is
            validated, but no client data is added or updated.<br />  Default:
            **false**
        cross_regional_update (bool): When `true`, the updated information is
            propagated to all of the region’s sites where the client has a
            profile.<br />  When `false`, only the local client is updated.<br />
            Default: **true**<br />  Important: The fields below will automatically
            propagate cross-regionally when updated through the UpdateClient
            endpoint, regardless the CrossRegionalUpdate parameter is set to `true`
            or `false`.      * `RSSID`   * `Prefix`   * `Name (First, Middle, Last,
            Nickname)`   * `Email`   * `Birthday`   * `Phone (Home, Mobile, Work,
            Extension)`   * `Address`
        new_id (str): The new RSSID to be used for the client. Use `NewId` to assign
            a specific number to be a client’s ID. If that number is not available,
            the call returns an error. This RSSID must be unique within the
            subscriber’s site. If this is a cross-regional update, the RSSID must be
            unique across the region. If the requested number is already in use, an
            error is returned.  Note: NewId value cannot fall within the reserved
            default ID range (100000000 -&gt; 101000000)
        lead_channel_id (int): The ID of the Lead Channel ID from lead management. If
            this is supplied then it will map lead channel on the lead management.
            If this is not supplied then it will have Publicapi LeadChannelId.  This
            parameters required to track the lead channel if new client added to the
            location.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client": "Client",
        "test": "Test",
        "cross_regional_update": "CrossRegionalUpdate",
        "new_id": "NewId",
        "lead_channel_id": "LeadChannelId",
    }

    _optionals = [
        "test",
        "cross_regional_update",
        "new_id",
        "lead_channel_id",
    ]

    def __init__(
        self,
        client=None,
        test=APIHelper.SKIP,
        cross_regional_update=APIHelper.SKIP,
        new_id=APIHelper.SKIP,
        lead_channel_id=APIHelper.SKIP):
        """Initialize a UpdateClientRequest instance."""
        # Initialize members of the class
        self.client = client
        if test is not APIHelper.SKIP:
            self.test = test
        if cross_regional_update is not APIHelper.SKIP:
            self.cross_regional_update = cross_regional_update
        if new_id is not APIHelper.SKIP:
            self.new_id = new_id
        if lead_channel_id is not APIHelper.SKIP:
            self.lead_channel_id = lead_channel_id

    @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 dictionary.get("Client") else None
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP
        cross_regional_update =\
            dictionary.get("CrossRegionalUpdate")\
            if "CrossRegionalUpdate" in dictionary.keys()\
                else APIHelper.SKIP
        new_id =\
            dictionary.get("NewId")\
            if dictionary.get("NewId")\
                else APIHelper.SKIP
        lead_channel_id =\
            dictionary.get("LeadChannelId")\
            if dictionary.get("LeadChannelId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client,
                   test,
                   cross_regional_update,
                   new_id,
                   lead_channel_id)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client=self.client
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _cross_regional_update=(
            self.cross_regional_update
            if hasattr(self, "cross_regional_update")
            else None
        )
        _new_id=(
            self.new_id
            if hasattr(self, "new_id")
            else None
        )
        _lead_channel_id=(
            self.lead_channel_id
            if hasattr(self, "lead_channel_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client={_client!r}, "
            f"test={_test!r}, "
            f"cross_regional_update={_cross_regional_update!r}, "
            f"new_id={_new_id!r}, "
            f"lead_channel_id={_lead_channel_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client=self.client
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _cross_regional_update=(
            self.cross_regional_update
            if hasattr(self, "cross_regional_update")
            else None
        )
        _new_id=(
            self.new_id
            if hasattr(self, "new_id")
            else None
        )
        _lead_channel_id=(
            self.lead_channel_id
            if hasattr(self, "lead_channel_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client={_client!s}, "
            f"test={_test!s}, "
            f"cross_regional_update={_cross_regional_update!s}, "
            f"new_id={_new_id!s}, "
            f"lead_channel_id={_lead_channel_id!s}, "
            f")"
        )
