"""mindbodypublicapi.

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

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


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

    Transactions Request

    Attributes:
        sale_id (int): Filters the transaction results with the ID number associated
            with the sale.
        transaction_id (int): Filters the transaction results with the ID number
            generated when the sale is processed.
        client_id (int): Filters results to the requested client ID.
        location_id (int): Filters the transaction results with the ID number
            associated with the location of the sale.
        status (str): Filters the transaction results by the estimated transaction
            status.
        transaction_start_date_time (datetime): Filters the transaction results that
            happpened after this date and time.   Default: **today’s date**
        transaction_end_date_time (datetime): Filters the transaction results that
            happpened before this date and time.   Default: **today’s date**
        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 = {
        "sale_id": "SaleId",
        "transaction_id": "TransactionId",
        "client_id": "ClientId",
        "location_id": "LocationId",
        "status": "Status",
        "transaction_start_date_time": "TransactionStartDateTime",
        "transaction_end_date_time": "TransactionEndDateTime",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "sale_id",
        "transaction_id",
        "client_id",
        "location_id",
        "status",
        "transaction_start_date_time",
        "transaction_end_date_time",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        sale_id=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        client_id=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        status=APIHelper.SKIP,
        transaction_start_date_time=APIHelper.SKIP,
        transaction_end_date_time=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetTransactionsRequest instance."""
        # Initialize members of the class
        if sale_id is not APIHelper.SKIP:
            self.sale_id = sale_id
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_id
        if client_id is not APIHelper.SKIP:
            self.client_id = client_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if status is not APIHelper.SKIP:
            self.status = status
        if transaction_start_date_time is not APIHelper.SKIP:
            self.transaction_start_date_time =\
                 APIHelper.apply_datetime_converter(
                transaction_start_date_time, APIHelper.RFC3339DateTime)\
                 if transaction_start_date_time else None
        if transaction_end_date_time is not APIHelper.SKIP:
            self.transaction_end_date_time =\
                 APIHelper.apply_datetime_converter(
                transaction_end_date_time, APIHelper.RFC3339DateTime)\
                 if transaction_end_date_time else None
        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
        sale_id =\
            dictionary.get("SaleId")\
            if dictionary.get("SaleId")\
                else APIHelper.SKIP
        transaction_id =\
            dictionary.get("TransactionId")\
            if dictionary.get("TransactionId")\
                else APIHelper.SKIP
        client_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        status =\
            dictionary.get("Status")\
            if dictionary.get("Status")\
                else APIHelper.SKIP
        transaction_start_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("TransactionStartDateTime")).datetime\
            if dictionary.get("TransactionStartDateTime") else APIHelper.SKIP
        transaction_end_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("TransactionEndDateTime")).datetime\
            if dictionary.get("TransactionEndDateTime") 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(sale_id,
                   transaction_id,
                   client_id,
                   location_id,
                   status,
                   transaction_start_date_time,
                   transaction_end_date_time,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _sale_id=(
            self.sale_id
            if hasattr(self, "sale_id")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _transaction_start_date_time=(
            self.transaction_start_date_time
            if hasattr(self, "transaction_start_date_time")
            else None
        )
        _transaction_end_date_time=(
            self.transaction_end_date_time
            if hasattr(self, "transaction_end_date_time")
            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"sale_id={_sale_id!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"client_id={_client_id!r}, "
            f"location_id={_location_id!r}, "
            f"status={_status!r}, "
            f"transaction_start_date_time={_transaction_start_date_time!r}, "
            f"transaction_end_date_time={_transaction_end_date_time!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _sale_id=(
            self.sale_id
            if hasattr(self, "sale_id")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            else None
        )
        _transaction_start_date_time=(
            self.transaction_start_date_time
            if hasattr(self, "transaction_start_date_time")
            else None
        )
        _transaction_end_date_time=(
            self.transaction_end_date_time
            if hasattr(self, "transaction_end_date_time")
            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"sale_id={_sale_id!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"client_id={_client_id!s}, "
            f"location_id={_location_id!s}, "
            f"status={_status!s}, "
            f"transaction_start_date_time={_transaction_start_date_time!s}, "
            f"transaction_end_date_time={_transaction_end_date_time!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
