"""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.client_service import (
    ClientService,
)


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

    Represents a specific visit to a class

    Attributes:
        appointment_id (int): The appointment’s ID.
        appointment_gender_preference (AppointmentGenderPreferenceEnum): The gender
            of staff member with whom the client prefers to book appointments.
            Possible values are:  * Female - Indicates that the client prefers to
            book appointments with female staff members.  * Male - Indicates that the
            client prefers to book appointments with male staff members.  * None -
            Indicates that the client does not have a staff member gender preference.
        appointment_status (AppointmentStatusEnum): The status of the appointment.
        class_id (int): The class ID that was used to retrieve the visits.
        client_id (str): The ID of the client associated with the visit.
        client_photo_url (str): PhotoUrl for the client
        client_unique_id (int): The unique ID of the client associated with the visit.
        start_date_time (datetime): The time this class is scheduled to start.
        end_date_time (datetime): The date and time the visit ends. The Public API
            returns UTC dates and times. For example, a class that occurs on June
            25th, 2018 at 2:15PM (EST) appears as “2018-06-25T19:15:00Z” because EST
            is five hours behind UTC. Date time pairs always return in the format
            YYYY-MM-DDTHH:mm:ssZ.
        id (int): The ID of the visit.
        last_modified_date_time (datetime): When included in the request, only
            records modified on or after the specified `LastModifiedDate` are
            included in the response. The Public API returns UTC dates and times. For
            example, a class that occurs on June 25th, 2018 at 2:15PM (EST) appears
            as “2018-06-25T19:15:00Z” because EST is five hours behind UTC. Date time
            pairs always return in the format YYYY-MM-DDTHH:mm:ssZ.
        late_cancelled (bool): When `true`, indicates that the class has been
            `LateCancelled`.<br />  When `false`, indicates that the class has not
            been `LateCancelled`.
        site_id (int): The ID of the business where the visit is booked.
        location_id (int): The ID of the location where the visit took place or is to
            take place.
        make_up (bool): When `true`, the client can make up this session and a
            session is not deducted from the pricing option that was used to sign the
            client into the enrollment. When the client has the make-up session, a
            session is automatically removed from a pricing option that matches the
            service category of the enrollment and is within the same date range of
            the missed session.<br />  When `false`, the client cannot make up this
            session. See [Enrollments:
            Make-ups](https://support.mindbodyonline.com/s/article/203259433-Enrollmen
            ts-Make-ups?language=en_US) for more information.
        name (str): The name of the class.
        service_id (int): The unique ID assigned to this pricing option when it was
            purchased by the client.
        service_name (str): The name of the pricing option at the site where it was
            purchased.
        service (ClientService): A service that is on a client's account.
        product_id (int): The ID of the pricing option at the site where it was
            purchased.
        signed_in (bool): When `true`, indicates that the client has been signed
            in.<br />  When `false`, indicates that the client has not been signed in.
        staff_id (int): The ID of the staff member who is teaching the class.
        web_signup (bool): When `true`, indicates that the client signed up
            online.<br />  When `false`, indicates that the client was signed up by a
            staff member.
        action (Action1Enum): The action taken.
        missed (bool): When `true`, indicates that the class has been `Missed`.<br />
            When `false`, indicates that the class has not been `Missed`.
        visit_type (int): Indicates the Id of visit type.
        type_group (int): Indicates the Id of type group.
        type_taken (str): Indicates the service type taken.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "appointment_id": "AppointmentId",
        "appointment_gender_preference": "AppointmentGenderPreference",
        "appointment_status": "AppointmentStatus",
        "class_id": "ClassId",
        "client_id": "ClientId",
        "client_photo_url": "ClientPhotoUrl",
        "client_unique_id": "ClientUniqueId",
        "start_date_time": "StartDateTime",
        "end_date_time": "EndDateTime",
        "id": "Id",
        "last_modified_date_time": "LastModifiedDateTime",
        "late_cancelled": "LateCancelled",
        "site_id": "SiteId",
        "location_id": "LocationId",
        "make_up": "MakeUp",
        "name": "Name",
        "service_id": "ServiceId",
        "service_name": "ServiceName",
        "service": "Service",
        "product_id": "ProductId",
        "signed_in": "SignedIn",
        "staff_id": "StaffId",
        "web_signup": "WebSignup",
        "action": "Action",
        "missed": "Missed",
        "visit_type": "VisitType",
        "type_group": "TypeGroup",
        "type_taken": "TypeTaken",
    }

    _optionals = [
        "appointment_id",
        "appointment_gender_preference",
        "appointment_status",
        "class_id",
        "client_id",
        "client_photo_url",
        "client_unique_id",
        "start_date_time",
        "end_date_time",
        "id",
        "last_modified_date_time",
        "late_cancelled",
        "site_id",
        "location_id",
        "make_up",
        "name",
        "service_id",
        "service_name",
        "service",
        "product_id",
        "signed_in",
        "staff_id",
        "web_signup",
        "action",
        "missed",
        "visit_type",
        "type_group",
        "type_taken",
    ]

    def __init__(
        self,
        appointment_id=APIHelper.SKIP,
        appointment_gender_preference=APIHelper.SKIP,
        appointment_status=APIHelper.SKIP,
        class_id=APIHelper.SKIP,
        client_id=APIHelper.SKIP,
        client_photo_url=APIHelper.SKIP,
        client_unique_id=APIHelper.SKIP,
        start_date_time=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        id=APIHelper.SKIP,
        last_modified_date_time=APIHelper.SKIP,
        late_cancelled=APIHelper.SKIP,
        site_id=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        make_up=APIHelper.SKIP,
        name=APIHelper.SKIP,
        service_id=APIHelper.SKIP,
        service_name=APIHelper.SKIP,
        service=APIHelper.SKIP,
        product_id=APIHelper.SKIP,
        signed_in=APIHelper.SKIP,
        staff_id=APIHelper.SKIP,
        web_signup=APIHelper.SKIP,
        action=APIHelper.SKIP,
        missed=APIHelper.SKIP,
        visit_type=APIHelper.SKIP,
        type_group=APIHelper.SKIP,
        type_taken=APIHelper.SKIP):
        """Initialize a Visit instance."""
        # Initialize members of the class
        if appointment_id is not APIHelper.SKIP:
            self.appointment_id = appointment_id
        if appointment_gender_preference is not APIHelper.SKIP:
            self.appointment_gender_preference = appointment_gender_preference
        if appointment_status is not APIHelper.SKIP:
            self.appointment_status = appointment_status
        if class_id is not APIHelper.SKIP:
            self.class_id = class_id
        if client_id is not APIHelper.SKIP:
            self.client_id = client_id
        if client_photo_url is not APIHelper.SKIP:
            self.client_photo_url = client_photo_url
        if client_unique_id is not APIHelper.SKIP:
            self.client_unique_id = client_unique_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 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 id is not APIHelper.SKIP:
            self.id = id
        if last_modified_date_time is not APIHelper.SKIP:
            self.last_modified_date_time =\
                 APIHelper.apply_datetime_converter(
                last_modified_date_time, APIHelper.RFC3339DateTime)\
                 if last_modified_date_time else None
        if late_cancelled is not APIHelper.SKIP:
            self.late_cancelled = late_cancelled
        if site_id is not APIHelper.SKIP:
            self.site_id = site_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if make_up is not APIHelper.SKIP:
            self.make_up = make_up
        if name is not APIHelper.SKIP:
            self.name = name
        if service_id is not APIHelper.SKIP:
            self.service_id = service_id
        if service_name is not APIHelper.SKIP:
            self.service_name = service_name
        if service is not APIHelper.SKIP:
            self.service = service
        if product_id is not APIHelper.SKIP:
            self.product_id = product_id
        if signed_in is not APIHelper.SKIP:
            self.signed_in = signed_in
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if web_signup is not APIHelper.SKIP:
            self.web_signup = web_signup
        if action is not APIHelper.SKIP:
            self.action = action
        if missed is not APIHelper.SKIP:
            self.missed = missed
        if visit_type is not APIHelper.SKIP:
            self.visit_type = visit_type
        if type_group is not APIHelper.SKIP:
            self.type_group = type_group
        if type_taken is not APIHelper.SKIP:
            self.type_taken = type_taken

    @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 APIHelper.SKIP
        appointment_gender_preference =\
            dictionary.get("AppointmentGenderPreference")\
            if dictionary.get("AppointmentGenderPreference")\
                else APIHelper.SKIP
        appointment_status =\
            dictionary.get("AppointmentStatus")\
            if dictionary.get("AppointmentStatus")\
                else APIHelper.SKIP
        class_id =\
            dictionary.get("ClassId")\
            if dictionary.get("ClassId")\
                else APIHelper.SKIP
        client_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else APIHelper.SKIP
        client_photo_url =\
            dictionary.get("ClientPhotoUrl")\
            if dictionary.get("ClientPhotoUrl")\
                else APIHelper.SKIP
        client_unique_id =\
            dictionary.get("ClientUniqueId")\
            if dictionary.get("ClientUniqueId")\
                else 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
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        last_modified_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("LastModifiedDateTime")).datetime\
            if dictionary.get("LastModifiedDateTime") else APIHelper.SKIP
        late_cancelled =\
            dictionary.get("LateCancelled")\
            if "LateCancelled" in dictionary.keys()\
                else APIHelper.SKIP
        site_id =\
            dictionary.get("SiteId")\
            if dictionary.get("SiteId")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        make_up =\
            dictionary.get("MakeUp")\
            if "MakeUp" in dictionary.keys()\
                else APIHelper.SKIP
        name =\
            dictionary.get("Name")\
            if dictionary.get("Name")\
                else APIHelper.SKIP
        service_id =\
            dictionary.get("ServiceId")\
            if dictionary.get("ServiceId")\
                else APIHelper.SKIP
        service_name =\
            dictionary.get("ServiceName")\
            if dictionary.get("ServiceName")\
                else APIHelper.SKIP
        service =\
            ClientService.from_dictionary(
                dictionary.get("Service"))\
                if "Service" in dictionary.keys()\
                else APIHelper.SKIP
        product_id =\
            dictionary.get("ProductId")\
            if dictionary.get("ProductId")\
                else APIHelper.SKIP
        signed_in =\
            dictionary.get("SignedIn")\
            if "SignedIn" in dictionary.keys()\
                else APIHelper.SKIP
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        web_signup =\
            dictionary.get("WebSignup")\
            if "WebSignup" in dictionary.keys()\
                else APIHelper.SKIP
        action =\
            dictionary.get("Action")\
            if dictionary.get("Action")\
                else APIHelper.SKIP
        missed =\
            dictionary.get("Missed")\
            if "Missed" in dictionary.keys()\
                else APIHelper.SKIP
        visit_type =\
            dictionary.get("VisitType")\
            if dictionary.get("VisitType")\
                else APIHelper.SKIP
        type_group =\
            dictionary.get("TypeGroup")\
            if dictionary.get("TypeGroup")\
                else APIHelper.SKIP
        type_taken =\
            dictionary.get("TypeTaken")\
            if dictionary.get("TypeTaken")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(appointment_id,
                   appointment_gender_preference,
                   appointment_status,
                   class_id,
                   client_id,
                   client_photo_url,
                   client_unique_id,
                   start_date_time,
                   end_date_time,
                   id,
                   last_modified_date_time,
                   late_cancelled,
                   site_id,
                   location_id,
                   make_up,
                   name,
                   service_id,
                   service_name,
                   service,
                   product_id,
                   signed_in,
                   staff_id,
                   web_signup,
                   action,
                   missed,
                   visit_type,
                   type_group,
                   type_taken)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _appointment_id=(
            self.appointment_id
            if hasattr(self, "appointment_id")
            else None
        )
        _appointment_gender_preference=(
            self.appointment_gender_preference
            if hasattr(self, "appointment_gender_preference")
            else None
        )
        _appointment_status=(
            self.appointment_status
            if hasattr(self, "appointment_status")
            else None
        )
        _class_id=(
            self.class_id
            if hasattr(self, "class_id")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _client_photo_url=(
            self.client_photo_url
            if hasattr(self, "client_photo_url")
            else None
        )
        _client_unique_id=(
            self.client_unique_id
            if hasattr(self, "client_unique_id")
            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
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _last_modified_date_time=(
            self.last_modified_date_time
            if hasattr(self, "last_modified_date_time")
            else None
        )
        _late_cancelled=(
            self.late_cancelled
            if hasattr(self, "late_cancelled")
            else None
        )
        _site_id=(
            self.site_id
            if hasattr(self, "site_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _make_up=(
            self.make_up
            if hasattr(self, "make_up")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _service_id=(
            self.service_id
            if hasattr(self, "service_id")
            else None
        )
        _service_name=(
            self.service_name
            if hasattr(self, "service_name")
            else None
        )
        _service=(
            self.service
            if hasattr(self, "service")
            else None
        )
        _product_id=(
            self.product_id
            if hasattr(self, "product_id")
            else None
        )
        _signed_in=(
            self.signed_in
            if hasattr(self, "signed_in")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _web_signup=(
            self.web_signup
            if hasattr(self, "web_signup")
            else None
        )
        _action=(
            self.action
            if hasattr(self, "action")
            else None
        )
        _missed=(
            self.missed
            if hasattr(self, "missed")
            else None
        )
        _visit_type=(
            self.visit_type
            if hasattr(self, "visit_type")
            else None
        )
        _type_group=(
            self.type_group
            if hasattr(self, "type_group")
            else None
        )
        _type_taken=(
            self.type_taken
            if hasattr(self, "type_taken")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"appointment_id={_appointment_id!r}, "
            f"appointment_gender_preference={_appointment_gender_preference!r}, "
            f"appointment_status={_appointment_status!r}, "
            f"class_id={_class_id!r}, "
            f"client_id={_client_id!r}, "
            f"client_photo_url={_client_photo_url!r}, "
            f"client_unique_id={_client_unique_id!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"id={_id!r}, "
            f"last_modified_date_time={_last_modified_date_time!r}, "
            f"late_cancelled={_late_cancelled!r}, "
            f"site_id={_site_id!r}, "
            f"location_id={_location_id!r}, "
            f"make_up={_make_up!r}, "
            f"name={_name!r}, "
            f"service_id={_service_id!r}, "
            f"service_name={_service_name!r}, "
            f"service={_service!r}, "
            f"product_id={_product_id!r}, "
            f"signed_in={_signed_in!r}, "
            f"staff_id={_staff_id!r}, "
            f"web_signup={_web_signup!r}, "
            f"action={_action!r}, "
            f"missed={_missed!r}, "
            f"visit_type={_visit_type!r}, "
            f"type_group={_type_group!r}, "
            f"type_taken={_type_taken!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _appointment_id=(
            self.appointment_id
            if hasattr(self, "appointment_id")
            else None
        )
        _appointment_gender_preference=(
            self.appointment_gender_preference
            if hasattr(self, "appointment_gender_preference")
            else None
        )
        _appointment_status=(
            self.appointment_status
            if hasattr(self, "appointment_status")
            else None
        )
        _class_id=(
            self.class_id
            if hasattr(self, "class_id")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _client_photo_url=(
            self.client_photo_url
            if hasattr(self, "client_photo_url")
            else None
        )
        _client_unique_id=(
            self.client_unique_id
            if hasattr(self, "client_unique_id")
            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
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _last_modified_date_time=(
            self.last_modified_date_time
            if hasattr(self, "last_modified_date_time")
            else None
        )
        _late_cancelled=(
            self.late_cancelled
            if hasattr(self, "late_cancelled")
            else None
        )
        _site_id=(
            self.site_id
            if hasattr(self, "site_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _make_up=(
            self.make_up
            if hasattr(self, "make_up")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _service_id=(
            self.service_id
            if hasattr(self, "service_id")
            else None
        )
        _service_name=(
            self.service_name
            if hasattr(self, "service_name")
            else None
        )
        _service=(
            self.service
            if hasattr(self, "service")
            else None
        )
        _product_id=(
            self.product_id
            if hasattr(self, "product_id")
            else None
        )
        _signed_in=(
            self.signed_in
            if hasattr(self, "signed_in")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _web_signup=(
            self.web_signup
            if hasattr(self, "web_signup")
            else None
        )
        _action=(
            self.action
            if hasattr(self, "action")
            else None
        )
        _missed=(
            self.missed
            if hasattr(self, "missed")
            else None
        )
        _visit_type=(
            self.visit_type
            if hasattr(self, "visit_type")
            else None
        )
        _type_group=(
            self.type_group
            if hasattr(self, "type_group")
            else None
        )
        _type_taken=(
            self.type_taken
            if hasattr(self, "type_taken")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"appointment_id={_appointment_id!s}, "
            f"appointment_gender_preference={_appointment_gender_preference!s}, "
            f"appointment_status={_appointment_status!s}, "
            f"class_id={_class_id!s}, "
            f"client_id={_client_id!s}, "
            f"client_photo_url={_client_photo_url!s}, "
            f"client_unique_id={_client_unique_id!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"id={_id!s}, "
            f"last_modified_date_time={_last_modified_date_time!s}, "
            f"late_cancelled={_late_cancelled!s}, "
            f"site_id={_site_id!s}, "
            f"location_id={_location_id!s}, "
            f"make_up={_make_up!s}, "
            f"name={_name!s}, "
            f"service_id={_service_id!s}, "
            f"service_name={_service_name!s}, "
            f"service={_service!s}, "
            f"product_id={_product_id!s}, "
            f"signed_in={_signed_in!s}, "
            f"staff_id={_staff_id!s}, "
            f"web_signup={_web_signup!s}, "
            f"action={_action!s}, "
            f"missed={_missed!s}, "
            f"visit_type={_visit_type!s}, "
            f"type_group={_type_group!s}, "
            f"type_taken={_type_taken!s}, "
            f")"
        )
