# coding: utf-8

"""
    Pinterest REST API

    Pinterest's REST API

    The version of the OpenAPI document: 5.23.0
    Contact: blah+oapicf@cliffano.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from pinterestsdk.models.catalogs_hotel_address import CatalogsHotelAddress
from pinterestsdk.models.catalogs_hotel_attributes_all_of_main_image import CatalogsHotelAttributesAllOfMainImage
from pinterestsdk.models.catalogs_hotel_guest_ratings import CatalogsHotelGuestRatings
from typing import Optional, Set
from typing_extensions import Self

class CatalogsHotelAttributes(BaseModel):
    """
    CatalogsHotelAttributes
    """ # noqa: E501
    address: Optional[CatalogsHotelAddress] = None
    base_price: Optional[StrictStr] = Field(default=None, description="Base price of the hotel room per night followed by the ISO currency code")
    brand: Optional[StrictStr] = Field(default=None, description="The brand to which this hotel belongs to.")
    category: Optional[StrictStr] = Field(default=None, description="The type of property. The category can be any type of internal description desired.")
    custom_label_0: Optional[StrictStr] = Field(default=None, description="Custom grouping of hotels")
    custom_label_1: Optional[StrictStr] = Field(default=None, description="Custom grouping of hotels")
    custom_label_2: Optional[StrictStr] = Field(default=None, description="Custom grouping of hotels")
    custom_label_3: Optional[StrictStr] = Field(default=None, description="Custom grouping of hotels")
    custom_label_4: Optional[StrictStr] = Field(default=None, description="Custom grouping of hotels")
    description: Optional[StrictStr] = Field(default=None, description="Brief description of the hotel.")
    guest_ratings: Optional[CatalogsHotelGuestRatings] = None
    latitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Latitude of the hotel.")
    link: Optional[StrictStr] = Field(default=None, description="Link to the product page")
    longitude: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Longitude of the hotel.")
    name: Optional[StrictStr] = Field(default=None, description="The hotel's name.")
    neighborhood: Optional[List[StrictStr]] = Field(default=None, description="A list of neighborhoods where the hotel is located")
    sale_price: Optional[StrictStr] = Field(default=None, description="Sale price of a hotel room per night. Used to advertise discounts off the regular price of the hotel.")
    additional_image_link: Optional[List[StrictStr]] = Field(default=None, description="<p><= 2000 characters</p> <p>The links to additional images for your hotel. Up to ten additional images can be used to show a hotel from different angles. Must begin with http:// or https://.</p>")
    main_image: Optional[CatalogsHotelAttributesAllOfMainImage] = None
    __properties: ClassVar[List[str]] = ["address", "base_price", "brand", "category", "custom_label_0", "custom_label_1", "custom_label_2", "custom_label_3", "custom_label_4", "description", "guest_ratings", "latitude", "link", "longitude", "name", "neighborhood", "sale_price", "additional_image_link", "main_image"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of CatalogsHotelAttributes from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of address
        if self.address:
            _dict['address'] = self.address.to_dict()
        # override the default output from pydantic by calling `to_dict()` of guest_ratings
        if self.guest_ratings:
            _dict['guest_ratings'] = self.guest_ratings.to_dict()
        # override the default output from pydantic by calling `to_dict()` of main_image
        if self.main_image:
            _dict['main_image'] = self.main_image.to_dict()
        # set to None if base_price (nullable) is None
        # and model_fields_set contains the field
        if self.base_price is None and "base_price" in self.model_fields_set:
            _dict['base_price'] = None

        # set to None if brand (nullable) is None
        # and model_fields_set contains the field
        if self.brand is None and "brand" in self.model_fields_set:
            _dict['brand'] = None

        # set to None if category (nullable) is None
        # and model_fields_set contains the field
        if self.category is None and "category" in self.model_fields_set:
            _dict['category'] = None

        # set to None if custom_label_0 (nullable) is None
        # and model_fields_set contains the field
        if self.custom_label_0 is None and "custom_label_0" in self.model_fields_set:
            _dict['custom_label_0'] = None

        # set to None if custom_label_1 (nullable) is None
        # and model_fields_set contains the field
        if self.custom_label_1 is None and "custom_label_1" in self.model_fields_set:
            _dict['custom_label_1'] = None

        # set to None if custom_label_2 (nullable) is None
        # and model_fields_set contains the field
        if self.custom_label_2 is None and "custom_label_2" in self.model_fields_set:
            _dict['custom_label_2'] = None

        # set to None if custom_label_3 (nullable) is None
        # and model_fields_set contains the field
        if self.custom_label_3 is None and "custom_label_3" in self.model_fields_set:
            _dict['custom_label_3'] = None

        # set to None if custom_label_4 (nullable) is None
        # and model_fields_set contains the field
        if self.custom_label_4 is None and "custom_label_4" in self.model_fields_set:
            _dict['custom_label_4'] = None

        # set to None if description (nullable) is None
        # and model_fields_set contains the field
        if self.description is None and "description" in self.model_fields_set:
            _dict['description'] = None

        # set to None if link (nullable) is None
        # and model_fields_set contains the field
        if self.link is None and "link" in self.model_fields_set:
            _dict['link'] = None

        # set to None if longitude (nullable) is None
        # and model_fields_set contains the field
        if self.longitude is None and "longitude" in self.model_fields_set:
            _dict['longitude'] = None

        # set to None if name (nullable) is None
        # and model_fields_set contains the field
        if self.name is None and "name" in self.model_fields_set:
            _dict['name'] = None

        # set to None if neighborhood (nullable) is None
        # and model_fields_set contains the field
        if self.neighborhood is None and "neighborhood" in self.model_fields_set:
            _dict['neighborhood'] = None

        # set to None if sale_price (nullable) is None
        # and model_fields_set contains the field
        if self.sale_price is None and "sale_price" in self.model_fields_set:
            _dict['sale_price'] = None

        # set to None if additional_image_link (nullable) is None
        # and model_fields_set contains the field
        if self.additional_image_link is None and "additional_image_link" in self.model_fields_set:
            _dict['additional_image_link'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of CatalogsHotelAttributes from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "address": CatalogsHotelAddress.from_dict(obj["address"]) if obj.get("address") is not None else None,
            "base_price": obj.get("base_price"),
            "brand": obj.get("brand"),
            "category": obj.get("category"),
            "custom_label_0": obj.get("custom_label_0"),
            "custom_label_1": obj.get("custom_label_1"),
            "custom_label_2": obj.get("custom_label_2"),
            "custom_label_3": obj.get("custom_label_3"),
            "custom_label_4": obj.get("custom_label_4"),
            "description": obj.get("description"),
            "guest_ratings": CatalogsHotelGuestRatings.from_dict(obj["guest_ratings"]) if obj.get("guest_ratings") is not None else None,
            "latitude": obj.get("latitude"),
            "link": obj.get("link"),
            "longitude": obj.get("longitude"),
            "name": obj.get("name"),
            "neighborhood": obj.get("neighborhood"),
            "sale_price": obj.get("sale_price"),
            "additional_image_link": obj.get("additional_image_link"),
            "main_image": CatalogsHotelAttributesAllOfMainImage.from_dict(obj["main_image"]) if obj.get("main_image") is not None else None
        })
        return _obj


