"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.update_contact_log_comment import (
    UpdateContactLogComment,
)
from mindbodypublicapi.models.update_contact_log_type import (
    UpdateContactLogType,
)


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

    Attributes:
        id (int): The ID of the contact log being updated.
        test (bool): When `true`, indicates that this is a test request and no data
            is inserted into the subscriber’s database.<br />  When `false`, the
            database is updated.
        assigned_to_staff_id (int): The ID of the staff member to whom the contact
            log is now being assigned.
        text (str): The contact log’s new text.
        contact_name (str): The name of the new person to be contacted by the
            assigned staff member.
        followup_by_date (datetime): The new date by which the assigned staff member
            should complete this contact log.
        contact_method (str): The new method by which the client wants to be
            contacted.
        is_complete (bool): When `true`, indicates that the contact log is complete.
            When `false`, indicates the contact log isn’t complete.
        comments (List[UpdateContactLogComment]): Contains information about the
            comments being updated or added to the contact log. Comments that have an
            ID of `0` are added to the contact log.
        types (List[UpdateContactLogType]): Contains information about the contact
            logs types being assigned to the contact log, in addition to the contact
            log types that are already assigned.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "Id",
        "test": "Test",
        "assigned_to_staff_id": "AssignedToStaffId",
        "text": "Text",
        "contact_name": "ContactName",
        "followup_by_date": "FollowupByDate",
        "contact_method": "ContactMethod",
        "is_complete": "IsComplete",
        "comments": "Comments",
        "types": "Types",
    }

    _optionals = [
        "id",
        "test",
        "assigned_to_staff_id",
        "text",
        "contact_name",
        "followup_by_date",
        "contact_method",
        "is_complete",
        "comments",
        "types",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        test=APIHelper.SKIP,
        assigned_to_staff_id=APIHelper.SKIP,
        text=APIHelper.SKIP,
        contact_name=APIHelper.SKIP,
        followup_by_date=APIHelper.SKIP,
        contact_method=APIHelper.SKIP,
        is_complete=APIHelper.SKIP,
        comments=APIHelper.SKIP,
        types=APIHelper.SKIP):
        """Initialize a UpdateContactLogRequest instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if test is not APIHelper.SKIP:
            self.test = test
        if assigned_to_staff_id is not APIHelper.SKIP:
            self.assigned_to_staff_id = assigned_to_staff_id
        if text is not APIHelper.SKIP:
            self.text = text
        if contact_name is not APIHelper.SKIP:
            self.contact_name = contact_name
        if followup_by_date is not APIHelper.SKIP:
            self.followup_by_date =\
                 APIHelper.apply_datetime_converter(
                followup_by_date, APIHelper.RFC3339DateTime)\
                 if followup_by_date else None
        if contact_method is not APIHelper.SKIP:
            self.contact_method = contact_method
        if is_complete is not APIHelper.SKIP:
            self.is_complete = is_complete
        if comments is not APIHelper.SKIP:
            self.comments = comments
        if types is not APIHelper.SKIP:
            self.types = types

    @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
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP
        assigned_to_staff_id =\
            dictionary.get("AssignedToStaffId")\
            if dictionary.get("AssignedToStaffId")\
                else APIHelper.SKIP
        text =\
            dictionary.get("Text")\
            if dictionary.get("Text")\
                else APIHelper.SKIP
        contact_name =\
            dictionary.get("ContactName")\
            if dictionary.get("ContactName")\
                else APIHelper.SKIP
        followup_by_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("FollowupByDate")).datetime\
            if dictionary.get("FollowupByDate") else APIHelper.SKIP
        contact_method =\
            dictionary.get("ContactMethod")\
            if dictionary.get("ContactMethod")\
                else APIHelper.SKIP
        is_complete =\
            dictionary.get("IsComplete")\
            if "IsComplete" in dictionary.keys()\
                else APIHelper.SKIP
        comments = None
        if dictionary.get("Comments") is not None:
            comments = [
                UpdateContactLogComment.from_dictionary(x)
                    for x in dictionary.get("Comments")
            ]
        else:
            comments = APIHelper.SKIP
        types = None
        if dictionary.get("Types") is not None:
            types = [
                UpdateContactLogType.from_dictionary(x)
                    for x in dictionary.get("Types")
            ]
        else:
            types = APIHelper.SKIP

        # Return an object of this model
        return cls(id,
                   test,
                   assigned_to_staff_id,
                   text,
                   contact_name,
                   followup_by_date,
                   contact_method,
                   is_complete,
                   comments,
                   types)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _assigned_to_staff_id=(
            self.assigned_to_staff_id
            if hasattr(self, "assigned_to_staff_id")
            else None
        )
        _text=(
            self.text
            if hasattr(self, "text")
            else None
        )
        _contact_name=(
            self.contact_name
            if hasattr(self, "contact_name")
            else None
        )
        _followup_by_date=(
            self.followup_by_date
            if hasattr(self, "followup_by_date")
            else None
        )
        _contact_method=(
            self.contact_method
            if hasattr(self, "contact_method")
            else None
        )
        _is_complete=(
            self.is_complete
            if hasattr(self, "is_complete")
            else None
        )
        _comments=(
            self.comments
            if hasattr(self, "comments")
            else None
        )
        _types=(
            self.types
            if hasattr(self, "types")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"test={_test!r}, "
            f"assigned_to_staff_id={_assigned_to_staff_id!r}, "
            f"text={_text!r}, "
            f"contact_name={_contact_name!r}, "
            f"followup_by_date={_followup_by_date!r}, "
            f"contact_method={_contact_method!r}, "
            f"is_complete={_is_complete!r}, "
            f"comments={_comments!r}, "
            f"types={_types!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _assigned_to_staff_id=(
            self.assigned_to_staff_id
            if hasattr(self, "assigned_to_staff_id")
            else None
        )
        _text=(
            self.text
            if hasattr(self, "text")
            else None
        )
        _contact_name=(
            self.contact_name
            if hasattr(self, "contact_name")
            else None
        )
        _followup_by_date=(
            self.followup_by_date
            if hasattr(self, "followup_by_date")
            else None
        )
        _contact_method=(
            self.contact_method
            if hasattr(self, "contact_method")
            else None
        )
        _is_complete=(
            self.is_complete
            if hasattr(self, "is_complete")
            else None
        )
        _comments=(
            self.comments
            if hasattr(self, "comments")
            else None
        )
        _types=(
            self.types
            if hasattr(self, "types")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"test={_test!s}, "
            f"assigned_to_staff_id={_assigned_to_staff_id!s}, "
            f"text={_text!s}, "
            f"contact_name={_contact_name!s}, "
            f"followup_by_date={_followup_by_date!s}, "
            f"contact_method={_contact_method!s}, "
            f"is_complete={_is_complete!s}, "
            f"comments={_comments!s}, "
            f"types={_types!s}, "
            f")"
        )
