"""mindbodypublicapi.

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

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


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

    Attributes:
        appointment_id (int): A unique ID for the appointment.
        end_date_time (datetime): The end date and time of the new appointment.   <br
            />Default: **StartDateTime**, offset by the staff member’s default
            appointment duration.
        execute (str): The action taken to add this appointment. Possible values are:
            confirm, unconfirm, arrive, unarrive, cancel, latecancel, complete.
        gender_preference (str): The client’s service provider gender preference.
        notes (str): Any general notes about this appointment.
        partner_external_id (str): Optional external key for api partners.
        provider_id (str): If a user has Complementary and Alternative Medicine
            features enabled, this parameter assigns a provider ID to the appointment.
        resource_ids (List[int]): A list of resource IDs to associate with the new
            appointment.
        send_email (bool): Whether to send client an email for cancellations. An
            email is sent only if the client has an email address and automatic
            emails have been set up.   <br />Default: **false**
        session_type_id (int): The session type associated with the new appointment.
        staff_id (int): The ID of the staff member who is adding the new appointment.
        start_date_time (datetime): The start date and time of the new appointment.
        apply_payment (bool): When `true`, appointment will be updated with a current
            applicable client service from the clients account.   <br />Default:
            **false**
        test (bool): When `true`, indicates that the method is to be validated, but
            no new appointment data is added.   <br />Default: **false**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "appointment_id": "AppointmentId",
        "end_date_time": "EndDateTime",
        "execute": "Execute",
        "gender_preference": "GenderPreference",
        "notes": "Notes",
        "partner_external_id": "PartnerExternalId",
        "provider_id": "ProviderId",
        "resource_ids": "ResourceIds",
        "send_email": "SendEmail",
        "session_type_id": "SessionTypeId",
        "staff_id": "StaffId",
        "start_date_time": "StartDateTime",
        "apply_payment": "ApplyPayment",
        "test": "Test",
    }

    _optionals = [
        "end_date_time",
        "execute",
        "gender_preference",
        "notes",
        "partner_external_id",
        "provider_id",
        "resource_ids",
        "send_email",
        "session_type_id",
        "staff_id",
        "start_date_time",
        "apply_payment",
        "test",
    ]

    def __init__(
        self,
        appointment_id=None,
        end_date_time=APIHelper.SKIP,
        execute=APIHelper.SKIP,
        gender_preference=APIHelper.SKIP,
        notes=APIHelper.SKIP,
        partner_external_id=APIHelper.SKIP,
        provider_id=APIHelper.SKIP,
        resource_ids=APIHelper.SKIP,
        send_email=APIHelper.SKIP,
        session_type_id=APIHelper.SKIP,
        staff_id=APIHelper.SKIP,
        start_date_time=APIHelper.SKIP,
        apply_payment=APIHelper.SKIP,
        test=APIHelper.SKIP):
        """Initialize a UpdateAppointmentRequest instance."""
        # Initialize members of the class
        self.appointment_id = appointment_id
        if end_date_time is not APIHelper.SKIP:
            self.end_date_time =\
                 APIHelper.apply_datetime_converter(
                end_date_time, APIHelper.RFC3339DateTime)\
                 if end_date_time else None
        if execute is not APIHelper.SKIP:
            self.execute = execute
        if gender_preference is not APIHelper.SKIP:
            self.gender_preference = gender_preference
        if notes is not APIHelper.SKIP:
            self.notes = notes
        if partner_external_id is not APIHelper.SKIP:
            self.partner_external_id = partner_external_id
        if provider_id is not APIHelper.SKIP:
            self.provider_id = provider_id
        if resource_ids is not APIHelper.SKIP:
            self.resource_ids = resource_ids
        if send_email is not APIHelper.SKIP:
            self.send_email = send_email
        if session_type_id is not APIHelper.SKIP:
            self.session_type_id = session_type_id
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if start_date_time is not APIHelper.SKIP:
            self.start_date_time =\
                 APIHelper.apply_datetime_converter(
                start_date_time, APIHelper.RFC3339DateTime)\
                 if start_date_time else None
        if apply_payment is not APIHelper.SKIP:
            self.apply_payment = apply_payment
        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
        appointment_id =\
            dictionary.get("AppointmentId")\
            if dictionary.get("AppointmentId")\
                else None
        end_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndDateTime")).datetime\
            if dictionary.get("EndDateTime") else APIHelper.SKIP
        execute =\
            dictionary.get("Execute")\
            if dictionary.get("Execute")\
                else APIHelper.SKIP
        gender_preference =\
            dictionary.get("GenderPreference")\
            if dictionary.get("GenderPreference")\
                else APIHelper.SKIP
        notes =\
            dictionary.get("Notes")\
            if dictionary.get("Notes")\
                else APIHelper.SKIP
        partner_external_id =\
            dictionary.get("PartnerExternalId")\
            if dictionary.get("PartnerExternalId")\
                else APIHelper.SKIP
        provider_id =\
            dictionary.get("ProviderId")\
            if dictionary.get("ProviderId")\
                else APIHelper.SKIP
        resource_ids =\
            dictionary.get("ResourceIds")\
            if dictionary.get("ResourceIds")\
                else APIHelper.SKIP
        send_email =\
            dictionary.get("SendEmail")\
            if "SendEmail" in dictionary.keys()\
                else APIHelper.SKIP
        session_type_id =\
            dictionary.get("SessionTypeId")\
            if dictionary.get("SessionTypeId")\
                else APIHelper.SKIP
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        start_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartDateTime")).datetime\
            if dictionary.get("StartDateTime") else APIHelper.SKIP
        apply_payment =\
            dictionary.get("ApplyPayment")\
            if "ApplyPayment" in dictionary.keys()\
                else APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(appointment_id,
                   end_date_time,
                   execute,
                   gender_preference,
                   notes,
                   partner_external_id,
                   provider_id,
                   resource_ids,
                   send_email,
                   session_type_id,
                   staff_id,
                   start_date_time,
                   apply_payment,
                   test)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _appointment_id=self.appointment_id
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _execute=(
            self.execute
            if hasattr(self, "execute")
            else None
        )
        _gender_preference=(
            self.gender_preference
            if hasattr(self, "gender_preference")
            else None
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _partner_external_id=(
            self.partner_external_id
            if hasattr(self, "partner_external_id")
            else None
        )
        _provider_id=(
            self.provider_id
            if hasattr(self, "provider_id")
            else None
        )
        _resource_ids=(
            self.resource_ids
            if hasattr(self, "resource_ids")
            else None
        )
        _send_email=(
            self.send_email
            if hasattr(self, "send_email")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _start_date_time=(
            self.start_date_time
            if hasattr(self, "start_date_time")
            else None
        )
        _apply_payment=(
            self.apply_payment
            if hasattr(self, "apply_payment")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"appointment_id={_appointment_id!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"execute={_execute!r}, "
            f"gender_preference={_gender_preference!r}, "
            f"notes={_notes!r}, "
            f"partner_external_id={_partner_external_id!r}, "
            f"provider_id={_provider_id!r}, "
            f"resource_ids={_resource_ids!r}, "
            f"send_email={_send_email!r}, "
            f"session_type_id={_session_type_id!r}, "
            f"staff_id={_staff_id!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"apply_payment={_apply_payment!r}, "
            f"test={_test!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _appointment_id=self.appointment_id
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _execute=(
            self.execute
            if hasattr(self, "execute")
            else None
        )
        _gender_preference=(
            self.gender_preference
            if hasattr(self, "gender_preference")
            else None
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _partner_external_id=(
            self.partner_external_id
            if hasattr(self, "partner_external_id")
            else None
        )
        _provider_id=(
            self.provider_id
            if hasattr(self, "provider_id")
            else None
        )
        _resource_ids=(
            self.resource_ids
            if hasattr(self, "resource_ids")
            else None
        )
        _send_email=(
            self.send_email
            if hasattr(self, "send_email")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _start_date_time=(
            self.start_date_time
            if hasattr(self, "start_date_time")
            else None
        )
        _apply_payment=(
            self.apply_payment
            if hasattr(self, "apply_payment")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"appointment_id={_appointment_id!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"execute={_execute!s}, "
            f"gender_preference={_gender_preference!s}, "
            f"notes={_notes!s}, "
            f"partner_external_id={_partner_external_id!s}, "
            f"provider_id={_provider_id!s}, "
            f"resource_ids={_resource_ids!s}, "
            f"send_email={_send_email!s}, "
            f"session_type_id={_session_type_id!s}, "
            f"staff_id={_staff_id!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"apply_payment={_apply_payment!s}, "
            f"test={_test!s}, "
            f")"
        )
