"""mindbodypublicapi.

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

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


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

    Represents a request to add a new appointment, including details such as client
    information, appointment timing, location, and additional preferences.

    Attributes:
        apply_payment (bool): When `true`, indicates that a payment should be applied
            to the appointment.   <br />Default: **true**
        client_id (str): The RRSID of the client for whom the new appointment is
            being made.
        duration (int): The duration of the appointment. This parameter is used to
            change the default duration of an appointment.
        execute (str): The action taken to add this appointment. Possible values are:
            confirm, unconfirm, arrive, unarrive, cancel, latecancel, complete.
        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.
        gender_preference (str): The client’s service provider gender preference.
        location_id (int): The ID of the location where the new appointment is to
            take place.
        notes (str): Any general notes about this appointment.
        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.
        staff_requested (bool): When `true`, indicates that the staff member was
            requested specifically by the client.
        start_date_time (datetime): The start date and time of the new appointment.
        test (bool): When true, indicates that the method is to be validated, but no
            new appointment data is added.   <br />Default: **false**
        is_waitlist (bool): When `true`, indicates that the client should be added to
            a specific appointment waiting list.  When `false`, the client should not
            be added to the waiting list.  Default: **false**
        is_request (bool): Indicates whether to add an appointment request for
            review.  If `true`, the appointment will be added as a request, bypassing
            the `IsWaitlist` parameter and two validations:  1. If a consumer is
            adding the appointment for another person.  2. If a staff member without
            permission to add appointments for other staff members is adding the
            appointment for another staff member.    This also allows anonymous calls
            (without an authentication token) to this endpoint.  The
            `AllowClientsToBookAppointments` option must be disabled. If it is
            enabled and the `IsRequest` parameter is `true`, it will return an error.
            For the appointment to be created as a request, one of the following
            conditions must also be met:  - The call is anonymous (no authentication
            token provided).  - The call is authenticated with a consumer token.  -
            The authenticated user lacks permission to book appointments for other
            staff (`BookAppointmentsForAllStaff`) and is attempting to book for a
            different staff member.    - In this last case, if the `IsRequest`
            parameter is `true` and the authenticated user has the
            `BookAppointmentsForAllStaff` permission or is attempting to book the
            appointment for themselves,    the appointment will be created, but not
            as an appointment request.    If `false`, the appointment will follow the
            standard creation process, respecting the `IsWaitlist` parameter.
            Default: `false`
        partner_external_id (str): Optional external key for api partners.
        add_appointment_request_id (int): A unique identifier for tracking the
            AddAppointmentRequest. This ID is not stored and is used to match each
            request with its corresponding response.  The request object will also be
            returned in the response, with the same ID value.  - For single requests,
            this value will be ignored.  - For multiple requests, if no value is
            provided, the system will generate an identifier ranging from 0 to
            (number of requests - 1).

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": "ClientId",
        "location_id": "LocationId",
        "session_type_id": "SessionTypeId",
        "staff_id": "StaffId",
        "start_date_time": "StartDateTime",
        "apply_payment": "ApplyPayment",
        "duration": "Duration",
        "execute": "Execute",
        "end_date_time": "EndDateTime",
        "gender_preference": "GenderPreference",
        "notes": "Notes",
        "provider_id": "ProviderId",
        "resource_ids": "ResourceIds",
        "send_email": "SendEmail",
        "staff_requested": "StaffRequested",
        "test": "Test",
        "is_waitlist": "IsWaitlist",
        "is_request": "IsRequest",
        "partner_external_id": "PartnerExternalId",
        "add_appointment_request_id": "AddAppointmentRequestId",
    }

    _optionals = [
        "apply_payment",
        "duration",
        "execute",
        "end_date_time",
        "gender_preference",
        "notes",
        "provider_id",
        "resource_ids",
        "send_email",
        "staff_requested",
        "test",
        "is_waitlist",
        "is_request",
        "partner_external_id",
        "add_appointment_request_id",
    ]

    def __init__(
        self,
        client_id=None,
        location_id=None,
        session_type_id=None,
        staff_id=None,
        start_date_time=None,
        apply_payment=APIHelper.SKIP,
        duration=APIHelper.SKIP,
        execute=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        gender_preference=APIHelper.SKIP,
        notes=APIHelper.SKIP,
        provider_id=APIHelper.SKIP,
        resource_ids=APIHelper.SKIP,
        send_email=APIHelper.SKIP,
        staff_requested=APIHelper.SKIP,
        test=APIHelper.SKIP,
        is_waitlist=APIHelper.SKIP,
        is_request=APIHelper.SKIP,
        partner_external_id=APIHelper.SKIP,
        add_appointment_request_id=APIHelper.SKIP):
        """Initialize a AddAppointmentRequest instance."""
        # Initialize members of the class
        if apply_payment is not APIHelper.SKIP:
            self.apply_payment = apply_payment
        self.client_id = client_id
        if duration is not APIHelper.SKIP:
            self.duration = duration
        if execute is not APIHelper.SKIP:
            self.execute = execute
        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 gender_preference is not APIHelper.SKIP:
            self.gender_preference = gender_preference
        self.location_id = location_id
        if notes is not APIHelper.SKIP:
            self.notes = notes
        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
        self.session_type_id = session_type_id
        self.staff_id = staff_id
        if staff_requested is not APIHelper.SKIP:
            self.staff_requested = staff_requested
        self.start_date_time =\
             APIHelper.apply_datetime_converter(
            start_date_time, APIHelper.RFC3339DateTime)\
             if start_date_time else None
        if test is not APIHelper.SKIP:
            self.test = test
        if is_waitlist is not APIHelper.SKIP:
            self.is_waitlist = is_waitlist
        if is_request is not APIHelper.SKIP:
            self.is_request = is_request
        if partner_external_id is not APIHelper.SKIP:
            self.partner_external_id = partner_external_id
        if add_appointment_request_id is not APIHelper.SKIP:
            self.add_appointment_request_id = add_appointment_request_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
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else None
        session_type_id =\
            dictionary.get("SessionTypeId")\
            if dictionary.get("SessionTypeId")\
                else None
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else None
        start_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartDateTime")).datetime\
            if dictionary.get("StartDateTime") else None
        apply_payment =\
            dictionary.get("ApplyPayment")\
            if "ApplyPayment" in dictionary.keys()\
                else APIHelper.SKIP
        duration =\
            dictionary.get("Duration")\
            if dictionary.get("Duration")\
                else APIHelper.SKIP
        execute =\
            dictionary.get("Execute")\
            if dictionary.get("Execute")\
                else APIHelper.SKIP
        end_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndDateTime")).datetime\
            if dictionary.get("EndDateTime") 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
        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
        staff_requested =\
            dictionary.get("StaffRequested")\
            if "StaffRequested" in dictionary.keys()\
                else APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP
        is_waitlist =\
            dictionary.get("IsWaitlist")\
            if "IsWaitlist" in dictionary.keys()\
                else APIHelper.SKIP
        is_request =\
            dictionary.get("IsRequest")\
            if "IsRequest" in dictionary.keys()\
                else APIHelper.SKIP
        partner_external_id =\
            dictionary.get("PartnerExternalId")\
            if dictionary.get("PartnerExternalId")\
                else APIHelper.SKIP
        add_appointment_request_id =\
            dictionary.get("AddAppointmentRequestId")\
            if dictionary.get("AddAppointmentRequestId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client_id,
                   location_id,
                   session_type_id,
                   staff_id,
                   start_date_time,
                   apply_payment,
                   duration,
                   execute,
                   end_date_time,
                   gender_preference,
                   notes,
                   provider_id,
                   resource_ids,
                   send_email,
                   staff_requested,
                   test,
                   is_waitlist,
                   is_request,
                   partner_external_id,
                   add_appointment_request_id)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _apply_payment=(
            self.apply_payment
            if hasattr(self, "apply_payment")
            else None
        )
        _client_id=self.client_id
        _duration=(
            self.duration
            if hasattr(self, "duration")
            else None
        )
        _execute=(
            self.execute
            if hasattr(self, "execute")
            else None
        )
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _gender_preference=(
            self.gender_preference
            if hasattr(self, "gender_preference")
            else None
        )
        _location_id=self.location_id
        _notes=(
            self.notes
            if hasattr(self, "notes")
            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
        _staff_id=self.staff_id
        _staff_requested=(
            self.staff_requested
            if hasattr(self, "staff_requested")
            else None
        )
        _start_date_time=self.start_date_time
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _is_waitlist=(
            self.is_waitlist
            if hasattr(self, "is_waitlist")
            else None
        )
        _is_request=(
            self.is_request
            if hasattr(self, "is_request")
            else None
        )
        _partner_external_id=(
            self.partner_external_id
            if hasattr(self, "partner_external_id")
            else None
        )
        _add_appointment_request_id=(
            self.add_appointment_request_id
            if hasattr(self, "add_appointment_request_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"apply_payment={_apply_payment!r}, "
            f"client_id={_client_id!r}, "
            f"duration={_duration!r}, "
            f"execute={_execute!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"gender_preference={_gender_preference!r}, "
            f"location_id={_location_id!r}, "
            f"notes={_notes!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"staff_requested={_staff_requested!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"test={_test!r}, "
            f"is_waitlist={_is_waitlist!r}, "
            f"is_request={_is_request!r}, "
            f"partner_external_id={_partner_external_id!r}, "
            f"add_appointment_request_id={_add_appointment_request_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _apply_payment=(
            self.apply_payment
            if hasattr(self, "apply_payment")
            else None
        )
        _client_id=self.client_id
        _duration=(
            self.duration
            if hasattr(self, "duration")
            else None
        )
        _execute=(
            self.execute
            if hasattr(self, "execute")
            else None
        )
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _gender_preference=(
            self.gender_preference
            if hasattr(self, "gender_preference")
            else None
        )
        _location_id=self.location_id
        _notes=(
            self.notes
            if hasattr(self, "notes")
            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
        _staff_id=self.staff_id
        _staff_requested=(
            self.staff_requested
            if hasattr(self, "staff_requested")
            else None
        )
        _start_date_time=self.start_date_time
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _is_waitlist=(
            self.is_waitlist
            if hasattr(self, "is_waitlist")
            else None
        )
        _is_request=(
            self.is_request
            if hasattr(self, "is_request")
            else None
        )
        _partner_external_id=(
            self.partner_external_id
            if hasattr(self, "partner_external_id")
            else None
        )
        _add_appointment_request_id=(
            self.add_appointment_request_id
            if hasattr(self, "add_appointment_request_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"apply_payment={_apply_payment!s}, "
            f"client_id={_client_id!s}, "
            f"duration={_duration!s}, "
            f"execute={_execute!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"gender_preference={_gender_preference!s}, "
            f"location_id={_location_id!s}, "
            f"notes={_notes!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"staff_requested={_staff_requested!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"test={_test!s}, "
            f"is_waitlist={_is_waitlist!s}, "
            f"is_request={_is_request!s}, "
            f"partner_external_id={_partner_external_id!s}, "
            f"add_appointment_request_id={_add_appointment_request_id!s}, "
            f")"
        )
