"""cellpointapi.

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

# ruff: noqa: E501
import dateutil.parser

from cellpointapi.api_helper import APIHelper
from cellpointapi.models.person_name import (
    PersonName,
)
from cellpointapi.models.phone import Phone
from cellpointapi.models.property import Property
from cellpointapi.models.room import Room


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

    Lodging industry data for the order.

    Attributes:
        booking_reference (str): Reference number for the booking
        group_name (str): Name of the lodging group
        group_code (str): Code of the lodging group
        brand_name (str): Name of the lodging brand
        brand_code (str): Code of the lodging brand
        check_in_date (date): The date of check-in.
        check_out_date (date): The date of check-out.
        number_of_guests (int): Number of guests staying at the lodging
        guests (List[PersonName]): The model property of type List[PersonName].
        property (Property): Details of the property where the lodging is located
        customer_service_phone (Phone): Phone number for customer service at the
            lodging
        fire_safety_indicator (bool): Defines if the facility conforms to the Hotel
            and Motel Fire Safety Act of 1990 or similar legislation
        rooms (List[Room]): The model property of type List[Room].
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "booking_reference": "bookingReference",
        "check_in_date": "checkInDate",
        "check_out_date": "checkOutDate",
        "guests": "guests",
        "property": "property",
        "rooms": "rooms",
        "group_name": "groupName",
        "group_code": "groupCode",
        "brand_name": "brandName",
        "brand_code": "brandCode",
        "number_of_guests": "numberOfGuests",
        "customer_service_phone": "customerServicePhone",
        "fire_safety_indicator": "fireSafetyIndicator",
    }

    _optionals = [
        "group_name",
        "group_code",
        "brand_name",
        "brand_code",
        "number_of_guests",
        "customer_service_phone",
        "fire_safety_indicator",
    ]

    def __init__(
        self,
        booking_reference=None,
        check_in_date=None,
        check_out_date=None,
        guests=None,
        property=None,
        rooms=None,
        group_name=APIHelper.SKIP,
        group_code=APIHelper.SKIP,
        brand_name=APIHelper.SKIP,
        brand_code=APIHelper.SKIP,
        number_of_guests=APIHelper.SKIP,
        customer_service_phone=APIHelper.SKIP,
        fire_safety_indicator=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a LodgingIndustryData instance."""
        # Initialize members of the class
        self.booking_reference = booking_reference
        if group_name is not APIHelper.SKIP:
            self.group_name = group_name
        if group_code is not APIHelper.SKIP:
            self.group_code = group_code
        if brand_name is not APIHelper.SKIP:
            self.brand_name = brand_name
        if brand_code is not APIHelper.SKIP:
            self.brand_code = brand_code
        self.check_in_date = check_in_date
        self.check_out_date = check_out_date
        if number_of_guests is not APIHelper.SKIP:
            self.number_of_guests = number_of_guests
        self.guests = guests
        self.property = property
        if customer_service_phone is not APIHelper.SKIP:
            self.customer_service_phone = customer_service_phone
        if fire_safety_indicator is not APIHelper.SKIP:
            self.fire_safety_indicator = fire_safety_indicator
        self.rooms = rooms

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @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
        booking_reference =\
            dictionary.get("bookingReference")\
            if dictionary.get("bookingReference")\
                else None
        check_in_date = dateutil.parser.parse(
            dictionary.get("checkInDate")).date()\
            if dictionary.get("checkInDate") else None
        check_out_date = dateutil.parser.parse(
            dictionary.get("checkOutDate")).date()\
            if dictionary.get("checkOutDate") else None
        guests = None
        if dictionary.get("guests") is not None:
            guests = [
                PersonName.from_dictionary(x)
                    for x in dictionary.get("guests")
            ]
        property =\
            Property.from_dictionary(
                dictionary.get("property"))\
                if dictionary.get("property") else None
        rooms = None
        if dictionary.get("rooms") is not None:
            rooms = [
                Room.from_dictionary(x)
                    for x in dictionary.get("rooms")
            ]
        group_name =\
            dictionary.get("groupName")\
            if dictionary.get("groupName")\
                else APIHelper.SKIP
        group_code =\
            dictionary.get("groupCode")\
            if dictionary.get("groupCode")\
                else APIHelper.SKIP
        brand_name =\
            dictionary.get("brandName")\
            if dictionary.get("brandName")\
                else APIHelper.SKIP
        brand_code =\
            dictionary.get("brandCode")\
            if dictionary.get("brandCode")\
                else APIHelper.SKIP
        number_of_guests =\
            dictionary.get("numberOfGuests")\
            if dictionary.get("numberOfGuests")\
                else APIHelper.SKIP
        customer_service_phone =\
            Phone.from_dictionary(
                dictionary.get("customerServicePhone"))\
                if "customerServicePhone" in dictionary.keys()\
                else APIHelper.SKIP
        fire_safety_indicator =\
            dictionary.get("fireSafetyIndicator")\
            if "fireSafetyIndicator" in dictionary.keys()\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(booking_reference,
                   check_in_date,
                   check_out_date,
                   guests,
                   property,
                   rooms,
                   group_name,
                   group_code,
                   brand_name,
                   brand_code,
                   number_of_guests,
                   customer_service_phone,
                   fire_safety_indicator,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _booking_reference=self.booking_reference
        _group_name=(
            self.group_name
            if hasattr(self, "group_name")
            else None
        )
        _group_code=(
            self.group_code
            if hasattr(self, "group_code")
            else None
        )
        _brand_name=(
            self.brand_name
            if hasattr(self, "brand_name")
            else None
        )
        _brand_code=(
            self.brand_code
            if hasattr(self, "brand_code")
            else None
        )
        _check_in_date=self.check_in_date
        _check_out_date=self.check_out_date
        _number_of_guests=(
            self.number_of_guests
            if hasattr(self, "number_of_guests")
            else None
        )
        _guests=self.guests
        _property=self.property
        _customer_service_phone=(
            self.customer_service_phone
            if hasattr(self, "customer_service_phone")
            else None
        )
        _fire_safety_indicator=(
            self.fire_safety_indicator
            if hasattr(self, "fire_safety_indicator")
            else None
        )
        _rooms=self.rooms
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"booking_reference={_booking_reference!r}, "
            f"group_name={_group_name!r}, "
            f"group_code={_group_code!r}, "
            f"brand_name={_brand_name!r}, "
            f"brand_code={_brand_code!r}, "
            f"check_in_date={_check_in_date!r}, "
            f"check_out_date={_check_out_date!r}, "
            f"number_of_guests={_number_of_guests!r}, "
            f"guests={_guests!r}, "
            f"property={_property!r}, "
            f"customer_service_phone={_customer_service_phone!r}, "
            f"fire_safety_indicator={_fire_safety_indicator!r}, "
            f"rooms={_rooms!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _booking_reference=self.booking_reference
        _group_name=(
            self.group_name
            if hasattr(self, "group_name")
            else None
        )
        _group_code=(
            self.group_code
            if hasattr(self, "group_code")
            else None
        )
        _brand_name=(
            self.brand_name
            if hasattr(self, "brand_name")
            else None
        )
        _brand_code=(
            self.brand_code
            if hasattr(self, "brand_code")
            else None
        )
        _check_in_date=self.check_in_date
        _check_out_date=self.check_out_date
        _number_of_guests=(
            self.number_of_guests
            if hasattr(self, "number_of_guests")
            else None
        )
        _guests=self.guests
        _property=self.property
        _customer_service_phone=(
            self.customer_service_phone
            if hasattr(self, "customer_service_phone")
            else None
        )
        _fire_safety_indicator=(
            self.fire_safety_indicator
            if hasattr(self, "fire_safety_indicator")
            else None
        )
        _rooms=self.rooms
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"booking_reference={_booking_reference!s}, "
            f"group_name={_group_name!s}, "
            f"group_code={_group_code!s}, "
            f"brand_name={_brand_name!s}, "
            f"brand_code={_brand_code!s}, "
            f"check_in_date={_check_in_date!s}, "
            f"check_out_date={_check_out_date!s}, "
            f"number_of_guests={_number_of_guests!s}, "
            f"guests={_guests!s}, "
            f"property={_property!s}, "
            f"customer_service_phone={_customer_service_phone!s}, "
            f"fire_safety_indicator={_fire_safety_indicator!s}, "
            f"rooms={_rooms!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
