"""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.resource_slim import (
    ResourceSlim,
)


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

    Attributes:
        staff_id (int): The ID of the staff member who is to provide the service
            being booked.
        location_id (int): The ID of the location where the appointment is to take
            place.
        session_type_id (int): The ID of the session type of this appointment.
        resources (List[ResourceSlim]): Contains information about the resources to
            be used for the appointment.
        start_date_time (datetime): The date and time that the appointment is to
            start in the business’ timezone. This value must be passed in the format
            yyyy-mm-ddThh:mm:ss.
        end_date_time (datetime): The date and time that the appointment is to end in
            the business’ timezone. This value must be passed in the format
            yyyy-mm-ddThh:mm:ss.
        provider_id (str): The National Provider Identifier (NPI) of the staff member
            who is to provide the service. For an explanation of Provider IDs, see
            [Provider
            IDs](https://support.mindbodyonline.com/s/article/204075743-Provider-IDs?l
            anguage=en_US).

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "staff_id": "StaffId",
        "location_id": "LocationId",
        "session_type_id": "SessionTypeId",
        "resources": "Resources",
        "start_date_time": "StartDateTime",
        "end_date_time": "EndDateTime",
        "provider_id": "ProviderId",
    }

    _optionals = [
        "staff_id",
        "location_id",
        "session_type_id",
        "resources",
        "start_date_time",
        "end_date_time",
        "provider_id",
    ]

    def __init__(
        self,
        staff_id=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        session_type_id=APIHelper.SKIP,
        resources=APIHelper.SKIP,
        start_date_time=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        provider_id=APIHelper.SKIP):
        """Initialize a CheckoutAppointmentBookingRequest instance."""
        # Initialize members of the class
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if session_type_id is not APIHelper.SKIP:
            self.session_type_id = session_type_id
        if resources is not APIHelper.SKIP:
            self.resources = resources
        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 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 provider_id is not APIHelper.SKIP:
            self.provider_id = provider_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
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        session_type_id =\
            dictionary.get("SessionTypeId")\
            if dictionary.get("SessionTypeId")\
                else APIHelper.SKIP
        resources = None
        if dictionary.get("Resources") is not None:
            resources = [
                ResourceSlim.from_dictionary(x)
                    for x in dictionary.get("Resources")
            ]
        else:
            resources = APIHelper.SKIP
        start_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartDateTime")).datetime\
            if dictionary.get("StartDateTime") else APIHelper.SKIP
        end_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndDateTime")).datetime\
            if dictionary.get("EndDateTime") else APIHelper.SKIP
        provider_id =\
            dictionary.get("ProviderId")\
            if dictionary.get("ProviderId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(staff_id,
                   location_id,
                   session_type_id,
                   resources,
                   start_date_time,
                   end_date_time,
                   provider_id)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _resources=(
            self.resources
            if hasattr(self, "resources")
            else None
        )
        _start_date_time=(
            self.start_date_time
            if hasattr(self, "start_date_time")
            else None
        )
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _provider_id=(
            self.provider_id
            if hasattr(self, "provider_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"staff_id={_staff_id!r}, "
            f"location_id={_location_id!r}, "
            f"session_type_id={_session_type_id!r}, "
            f"resources={_resources!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"provider_id={_provider_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _resources=(
            self.resources
            if hasattr(self, "resources")
            else None
        )
        _start_date_time=(
            self.start_date_time
            if hasattr(self, "start_date_time")
            else None
        )
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _provider_id=(
            self.provider_id
            if hasattr(self, "provider_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"staff_id={_staff_id!s}, "
            f"location_id={_location_id!s}, "
            f"session_type_id={_session_type_id!s}, "
            f"resources={_resources!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"provider_id={_provider_id!s}, "
            f")"
        )
