"""mindbodypublicapi.

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

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


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

    Add Client To Enrollment Request Model

    Attributes:
        client_id (str): The client IDs of the clients to add to the specified
            enrollments.
        class_schedule_id (int): The class schedule IDs of the enrollments to add the
            clients to. The ClassScheduleId can be found in GetEnrollments as the
            EnrollmentId.
        enroll_date_forward (datetime): Enroll the clients from this date forward.
            `EnrollDateForward` takes priority over open enrollment.  Default:
            **null**
        enroll_open (List[datetime]): Enroll for selected dates.
        test (bool): When `true`, input information is validated, but not
            committed.<br />  Default: **false**
        send_email (bool): When `true`, indicates that the client should be sent an
            email. An email is only sent if the client has an email address and
            automatic emails have been set up. <br />  Default: **false**
        waitlist (bool): When `true`, the client is added to a specific enrollments
            waiting list.  Default: **false**
        waitlist_entry_id (int): The waiting list entry to add. Used to add a client
            to an enrollment from a waiting list entry.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": "ClientId",
        "class_schedule_id": "ClassScheduleId",
        "enroll_date_forward": "EnrollDateForward",
        "enroll_open": "EnrollOpen",
        "test": "Test",
        "send_email": "SendEmail",
        "waitlist": "Waitlist",
        "waitlist_entry_id": "WaitlistEntryId",
    }

    _optionals = [
        "enroll_date_forward",
        "enroll_open",
        "test",
        "send_email",
        "waitlist",
        "waitlist_entry_id",
    ]

    def __init__(
        self,
        client_id=None,
        class_schedule_id=None,
        enroll_date_forward=APIHelper.SKIP,
        enroll_open=APIHelper.SKIP,
        test=APIHelper.SKIP,
        send_email=APIHelper.SKIP,
        waitlist=APIHelper.SKIP,
        waitlist_entry_id=APIHelper.SKIP):
        """Initialize a AddClientToEnrollmentRequest instance."""
        # Initialize members of the class
        self.client_id = client_id
        self.class_schedule_id = class_schedule_id
        if enroll_date_forward is not APIHelper.SKIP:
            self.enroll_date_forward =\
                 APIHelper.apply_datetime_converter(
                enroll_date_forward, APIHelper.RFC3339DateTime)\
                 if enroll_date_forward else None
        if enroll_open is not None and enroll_open is not APIHelper.SKIP:
            self.enroll_open = APIHelper.apply_datetime_converter(
                enroll_open, APIHelper.RFC3339DateTime)
        if test is not APIHelper.SKIP:
            self.test = test
        if send_email is not APIHelper.SKIP:
            self.send_email = send_email
        if waitlist is not APIHelper.SKIP:
            self.waitlist = waitlist
        if waitlist_entry_id is not APIHelper.SKIP:
            self.waitlist_entry_id = waitlist_entry_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_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else None
        class_schedule_id =\
            dictionary.get("ClassScheduleId")\
            if dictionary.get("ClassScheduleId")\
                else None
        enroll_date_forward = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EnrollDateForward")).datetime\
            if dictionary.get("EnrollDateForward") else APIHelper.SKIP
        enroll_open = None
        if dictionary.get("EnrollOpen") is not None:
            enroll_open = list()
            for x in dictionary.get("EnrollOpen"):
                enroll_open.append(APIHelper.RFC3339DateTime.from_value(x).datetime)
        else:
            enroll_open = APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP
        send_email =\
            dictionary.get("SendEmail")\
            if "SendEmail" in dictionary.keys()\
                else APIHelper.SKIP
        waitlist =\
            dictionary.get("Waitlist")\
            if "Waitlist" in dictionary.keys()\
                else APIHelper.SKIP
        waitlist_entry_id =\
            dictionary.get("WaitlistEntryId")\
            if dictionary.get("WaitlistEntryId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client_id,
                   class_schedule_id,
                   enroll_date_forward,
                   enroll_open,
                   test,
                   send_email,
                   waitlist,
                   waitlist_entry_id)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client_id=self.client_id
        _class_schedule_id=self.class_schedule_id
        _enroll_date_forward=(
            self.enroll_date_forward
            if hasattr(self, "enroll_date_forward")
            else None
        )
        _enroll_open=(
            self.enroll_open
            if hasattr(self, "enroll_open")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _send_email=(
            self.send_email
            if hasattr(self, "send_email")
            else None
        )
        _waitlist=(
            self.waitlist
            if hasattr(self, "waitlist")
            else None
        )
        _waitlist_entry_id=(
            self.waitlist_entry_id
            if hasattr(self, "waitlist_entry_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!r}, "
            f"class_schedule_id={_class_schedule_id!r}, "
            f"enroll_date_forward={_enroll_date_forward!r}, "
            f"enroll_open={_enroll_open!r}, "
            f"test={_test!r}, "
            f"send_email={_send_email!r}, "
            f"waitlist={_waitlist!r}, "
            f"waitlist_entry_id={_waitlist_entry_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client_id=self.client_id
        _class_schedule_id=self.class_schedule_id
        _enroll_date_forward=(
            self.enroll_date_forward
            if hasattr(self, "enroll_date_forward")
            else None
        )
        _enroll_open=(
            self.enroll_open
            if hasattr(self, "enroll_open")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _send_email=(
            self.send_email
            if hasattr(self, "send_email")
            else None
        )
        _waitlist=(
            self.waitlist
            if hasattr(self, "waitlist")
            else None
        )
        _waitlist_entry_id=(
            self.waitlist_entry_id
            if hasattr(self, "waitlist_entry_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!s}, "
            f"class_schedule_id={_class_schedule_id!s}, "
            f"enroll_date_forward={_enroll_date_forward!s}, "
            f"enroll_open={_enroll_open!s}, "
            f"test={_test!s}, "
            f"send_email={_send_email!s}, "
            f"waitlist={_waitlist!s}, "
            f"waitlist_entry_id={_waitlist_entry_id!s}, "
            f")"
        )
