"""mindbodypublicapi.

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

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


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

    Attributes:
        client_id (str): The ID of the client for whom memberships are returned.
        unique_client_id (int): The Unique ID of the client for whom memberships are
            returned. Note that UniqueClientId takes precedence over ClientId if both
            are provided.
        location_id (int): Filters results to memberships that can be used to pay for
            scheduled services at that location. This parameter can not be passed
            when `CrossRegionalLookup` is `true`.
        cross_regional_lookup (bool): Used to retrieve a client’s memberships from
            multiple sites within an organization. When included and set to `true`,
            it searches a maximum of ten sites with which this client is associated.
            When a client is associated with more than ten sites, use
            `ClientAssociatedSitesOffset` as many times as needed to search the
            additional sites with which the client is associated. You can use the
            `CrossRegionalClientAssociations` value from `GET
            CrossRegionalClientAssociations` to determine how many sites the client
            is associated with. Note that a `SiteID` is returned and populated in the
            `ClientServices` response when `CrossRegionalLookup` is set to `true`.
            Default: **false**
        client_associated_sites_offset (int): Used to retrieve a client’s memberships
            from multiple sites within an organization when the client is associated
            with more than ten sites. To change which ten sites are searched, change
            this offset value. A value of 0 means that no sites are skipped and the
            first ten sites are returned. You can use the
            `CrossRegionalClientAssociations` value from `GET
            CrossRegionalClientAssociations` to determine how many sites the client
            is associated with. Note that you must always have `CrossRegionalLookup`
            set to `true` to use this parameter.<br />  Default: **0**    For
            example, if a client is associated with 25 sites, you need to call GET
            `ActiveClientMemberships` three times, as follows:  * Use GET
            `CrossRegionalClientAssociations` to determine how many sites a client is
            associated with, which tells you how many additional calls you need to
            make.  * Either omit `ClientAssociatedSitesOffset` or set it to 0 to
            return the client’s memberships from sites 1-10  * Set
            `ClientAssociatedSitesOffset` to 10 to return the client’s memberships
            from sites 11-20  * Set `ClientAssociatedSitesOffset` to 20 to return the
            client’s memberships from sites 21-25
        limit (int): Number of results to include, defaults to 100
        offset (int): Page offset, defaults to 0.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": "ClientId",
        "unique_client_id": "UniqueClientId",
        "location_id": "LocationId",
        "cross_regional_lookup": "CrossRegionalLookup",
        "client_associated_sites_offset": "ClientAssociatedSitesOffset",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "unique_client_id",
        "location_id",
        "cross_regional_lookup",
        "client_associated_sites_offset",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        client_id=None,
        unique_client_id=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        cross_regional_lookup=APIHelper.SKIP,
        client_associated_sites_offset=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetActiveClientMembershipsRequest instance."""
        # Initialize members of the class
        self.client_id = client_id
        if unique_client_id is not APIHelper.SKIP:
            self.unique_client_id = unique_client_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if cross_regional_lookup is not APIHelper.SKIP:
            self.cross_regional_lookup = cross_regional_lookup
        if client_associated_sites_offset is not APIHelper.SKIP:
            self.client_associated_sites_offset = client_associated_sites_offset
        if limit is not APIHelper.SKIP:
            self.limit = limit
        if offset is not APIHelper.SKIP:
            self.offset = offset

    @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_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else None
        unique_client_id =\
            dictionary.get("UniqueClientId")\
            if dictionary.get("UniqueClientId")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        cross_regional_lookup =\
            dictionary.get("CrossRegionalLookup")\
            if "CrossRegionalLookup" in dictionary.keys()\
                else APIHelper.SKIP
        client_associated_sites_offset =\
            dictionary.get("ClientAssociatedSitesOffset")\
            if dictionary.get("ClientAssociatedSitesOffset")\
                else APIHelper.SKIP
        limit =\
            dictionary.get("Limit")\
            if dictionary.get("Limit")\
                else APIHelper.SKIP
        offset =\
            dictionary.get("Offset")\
            if dictionary.get("Offset")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client_id,
                   unique_client_id,
                   location_id,
                   cross_regional_lookup,
                   client_associated_sites_offset,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client_id=self.client_id
        _unique_client_id=(
            self.unique_client_id
            if hasattr(self, "unique_client_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _cross_regional_lookup=(
            self.cross_regional_lookup
            if hasattr(self, "cross_regional_lookup")
            else None
        )
        _client_associated_sites_offset=(
            self.client_associated_sites_offset
            if hasattr(self, "client_associated_sites_offset")
            else None
        )
        _limit=(
            self.limit
            if hasattr(self, "limit")
            else None
        )
        _offset=(
            self.offset
            if hasattr(self, "offset")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!r}, "
            f"unique_client_id={_unique_client_id!r}, "
            f"location_id={_location_id!r}, "
            f"cross_regional_lookup={_cross_regional_lookup!r}, "
            f"client_associated_sites_offset={_client_associated_sites_offset!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client_id=self.client_id
        _unique_client_id=(
            self.unique_client_id
            if hasattr(self, "unique_client_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _cross_regional_lookup=(
            self.cross_regional_lookup
            if hasattr(self, "cross_regional_lookup")
            else None
        )
        _client_associated_sites_offset=(
            self.client_associated_sites_offset
            if hasattr(self, "client_associated_sites_offset")
            else None
        )
        _limit=(
            self.limit
            if hasattr(self, "limit")
            else None
        )
        _offset=(
            self.offset
            if hasattr(self, "offset")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!s}, "
            f"unique_client_id={_unique_client_id!s}, "
            f"location_id={_location_id!s}, "
            f"cross_regional_lookup={_cross_regional_lookup!s}, "
            f"client_associated_sites_offset={_client_associated_sites_offset!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
