"""mindbodypublicapi.

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

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


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

    Request query information for GET sale/contracts endpoint

    Attributes:
        contract_ids (List[int]): When included, the response only contains details
            about the specified contract IDs.
        sold_online (bool): When `true`, the response only contains details about
            contracts and AutoPay options that can be sold online.   When `false`,
            all contracts are returned.  Default: **false**
        location_id (int): The ID of the location that has the requested contracts
            and AutoPay options.
        unique_client_id (int): The ID of the client.
        promo_code (str): PromoCode to apply
        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 = {
        "location_id": "LocationId",
        "contract_ids": "ContractIds",
        "sold_online": "SoldOnline",
        "unique_client_id": "UniqueClientId",
        "promo_code": "PromoCode",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "contract_ids",
        "sold_online",
        "unique_client_id",
        "promo_code",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        location_id=None,
        contract_ids=APIHelper.SKIP,
        sold_online=APIHelper.SKIP,
        unique_client_id=APIHelper.SKIP,
        promo_code=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetContractsRequest instance."""
        # Initialize members of the class
        if contract_ids is not APIHelper.SKIP:
            self.contract_ids = contract_ids
        if sold_online is not APIHelper.SKIP:
            self.sold_online = sold_online
        self.location_id = location_id
        if unique_client_id is not APIHelper.SKIP:
            self.unique_client_id = unique_client_id
        if promo_code is not APIHelper.SKIP:
            self.promo_code = promo_code
        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
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else None
        contract_ids =\
            dictionary.get("ContractIds")\
            if dictionary.get("ContractIds")\
                else APIHelper.SKIP
        sold_online =\
            dictionary.get("SoldOnline")\
            if "SoldOnline" in dictionary.keys()\
                else APIHelper.SKIP
        unique_client_id =\
            dictionary.get("UniqueClientId")\
            if dictionary.get("UniqueClientId")\
                else APIHelper.SKIP
        promo_code =\
            dictionary.get("PromoCode")\
            if dictionary.get("PromoCode")\
                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(location_id,
                   contract_ids,
                   sold_online,
                   unique_client_id,
                   promo_code,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _contract_ids=(
            self.contract_ids
            if hasattr(self, "contract_ids")
            else None
        )
        _sold_online=(
            self.sold_online
            if hasattr(self, "sold_online")
            else None
        )
        _location_id=self.location_id
        _unique_client_id=(
            self.unique_client_id
            if hasattr(self, "unique_client_id")
            else None
        )
        _promo_code=(
            self.promo_code
            if hasattr(self, "promo_code")
            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"contract_ids={_contract_ids!r}, "
            f"sold_online={_sold_online!r}, "
            f"location_id={_location_id!r}, "
            f"unique_client_id={_unique_client_id!r}, "
            f"promo_code={_promo_code!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _contract_ids=(
            self.contract_ids
            if hasattr(self, "contract_ids")
            else None
        )
        _sold_online=(
            self.sold_online
            if hasattr(self, "sold_online")
            else None
        )
        _location_id=self.location_id
        _unique_client_id=(
            self.unique_client_id
            if hasattr(self, "unique_client_id")
            else None
        )
        _promo_code=(
            self.promo_code
            if hasattr(self, "promo_code")
            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"contract_ids={_contract_ids!s}, "
            f"sold_online={_sold_online!s}, "
            f"location_id={_location_id!s}, "
            f"unique_client_id={_unique_client_id!s}, "
            f"promo_code={_promo_code!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
