"""mindbodypublicapi.

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

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


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

    Attributes:
        service_id (int): The ID of the service to update.
        active_date (datetime): The date that the service became active.
        expiration_date (datetime): The date that the service is to expire.
        count (int): The number of client service sessions to update.
        test (bool): When `true`, indicates that input information is to be
            validated, but not committed.<br />  When `false` or omitted, the
            database is affected.<br />  Default: **false**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "service_id": "ServiceId",
        "active_date": "ActiveDate",
        "expiration_date": "ExpirationDate",
        "count": "Count",
        "test": "Test",
    }

    _optionals = [
        "active_date",
        "expiration_date",
        "count",
        "test",
    ]

    def __init__(
        self,
        service_id=None,
        active_date=APIHelper.SKIP,
        expiration_date=APIHelper.SKIP,
        count=APIHelper.SKIP,
        test=APIHelper.SKIP):
        """Initialize a UpdateClientServiceRequest instance."""
        # Initialize members of the class
        self.service_id = service_id
        if active_date is not APIHelper.SKIP:
            self.active_date =\
                 APIHelper.apply_datetime_converter(
                active_date, APIHelper.RFC3339DateTime)\
                 if active_date else None
        if expiration_date is not APIHelper.SKIP:
            self.expiration_date =\
                 APIHelper.apply_datetime_converter(
                expiration_date, APIHelper.RFC3339DateTime)\
                 if expiration_date else None
        if count is not APIHelper.SKIP:
            self.count = count
        if test is not APIHelper.SKIP:
            self.test = test

    @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
        service_id =\
            dictionary.get("ServiceId")\
            if dictionary.get("ServiceId")\
                else None
        active_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("ActiveDate")).datetime\
            if dictionary.get("ActiveDate") else APIHelper.SKIP
        expiration_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("ExpirationDate")).datetime\
            if dictionary.get("ExpirationDate") else APIHelper.SKIP
        count =\
            dictionary.get("Count")\
            if dictionary.get("Count")\
                else APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(service_id,
                   active_date,
                   expiration_date,
                   count,
                   test)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _service_id=self.service_id
        _active_date=(
            self.active_date
            if hasattr(self, "active_date")
            else None
        )
        _expiration_date=(
            self.expiration_date
            if hasattr(self, "expiration_date")
            else None
        )
        _count=(
            self.count
            if hasattr(self, "count")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"service_id={_service_id!r}, "
            f"active_date={_active_date!r}, "
            f"expiration_date={_expiration_date!r}, "
            f"count={_count!r}, "
            f"test={_test!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _service_id=self.service_id
        _active_date=(
            self.active_date
            if hasattr(self, "active_date")
            else None
        )
        _expiration_date=(
            self.expiration_date
            if hasattr(self, "expiration_date")
            else None
        )
        _count=(
            self.count
            if hasattr(self, "count")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"service_id={_service_id!s}, "
            f"active_date={_active_date!s}, "
            f"expiration_date={_expiration_date!s}, "
            f"count={_count!s}, "
            f"test={_test!s}, "
            f")"
        )
