"""mindbodypublicapi.

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

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


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

    Attributes:
        client_id (str): The ID of the requested client.
        location_id (int): The ID of the location for the requested arrival.
        arrival_type_id (int): The ID of the arrival program (service category) under
            which this arrival is to be logged. If this is not provided, the program
            ID of the first arrival pricing option found will be used.  OPTIONAL:
            will take first payment found if not provided  Default: **null**
        lead_channel_id (int): The ID of the Lead Channel ID from lead management. If
            this is supplied then it will map lead channel on the lead management.
            If this is not supplied then it wont save anything.  This parameters
            required to track the lead channel if new client added while adding
            arrival of client on non home location.
        test (bool): When `true`, indicates that the arrival log is to be validated,
            but no new arrival data is added. When `false`, the arrival is logged and
            the database is affected.  Default: **false**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": "ClientId",
        "location_id": "LocationId",
        "arrival_type_id": "ArrivalTypeId",
        "lead_channel_id": "LeadChannelId",
        "test": "Test",
    }

    _optionals = [
        "arrival_type_id",
        "lead_channel_id",
        "test",
    ]

    def __init__(
        self,
        client_id=None,
        location_id=None,
        arrival_type_id=APIHelper.SKIP,
        lead_channel_id=APIHelper.SKIP,
        test=APIHelper.SKIP):
        """Initialize a AddArrivalRequest instance."""
        # Initialize members of the class
        self.client_id = client_id
        self.location_id = location_id
        if arrival_type_id is not APIHelper.SKIP:
            self.arrival_type_id = arrival_type_id
        if lead_channel_id is not APIHelper.SKIP:
            self.lead_channel_id = lead_channel_id
        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
        client_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else None
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else None
        arrival_type_id =\
            dictionary.get("ArrivalTypeId")\
            if dictionary.get("ArrivalTypeId")\
                else APIHelper.SKIP
        lead_channel_id =\
            dictionary.get("LeadChannelId")\
            if dictionary.get("LeadChannelId")\
                else APIHelper.SKIP
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client_id,
                   location_id,
                   arrival_type_id,
                   lead_channel_id,
                   test)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client_id=self.client_id
        _location_id=self.location_id
        _arrival_type_id=(
            self.arrival_type_id
            if hasattr(self, "arrival_type_id")
            else None
        )
        _lead_channel_id=(
            self.lead_channel_id
            if hasattr(self, "lead_channel_id")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!r}, "
            f"location_id={_location_id!r}, "
            f"arrival_type_id={_arrival_type_id!r}, "
            f"lead_channel_id={_lead_channel_id!r}, "
            f"test={_test!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client_id=self.client_id
        _location_id=self.location_id
        _arrival_type_id=(
            self.arrival_type_id
            if hasattr(self, "arrival_type_id")
            else None
        )
        _lead_channel_id=(
            self.lead_channel_id
            if hasattr(self, "lead_channel_id")
            else None
        )
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"client_id={_client_id!s}, "
            f"location_id={_location_id!s}, "
            f"arrival_type_id={_arrival_type_id!s}, "
            f"lead_channel_id={_lead_channel_id!s}, "
            f"test={_test!s}, "
            f")"
        )
