# 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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class CatalogsUpdatableCreativeAssetsAttributes(BaseModel):
    """
    CatalogsUpdatableCreativeAssetsAttributes
    """ # noqa: E501
    android_deep_link: Optional[StrictStr] = Field(default=None, description="Link to the creative assets page.")
    custom_label_0: Optional[StrictStr] = Field(default=None, description="Custom grouping of creative assets.")
    custom_label_1: Optional[StrictStr] = Field(default=None, description="Custom grouping of creative assets.")
    custom_label_2: Optional[StrictStr] = Field(default=None, description="Custom grouping of creative assets.")
    custom_label_3: Optional[StrictStr] = Field(default=None, description="Custom grouping of creative assets.")
    custom_label_4: Optional[StrictStr] = Field(default=None, description="Custom grouping of creative assets.")
    description: Optional[StrictStr] = Field(default=None, description="Brief description of the creative assets.")
    google_product_category: Optional[StrictStr] = Field(default=None, description="The categorization of the product based on the standardized Google Product Taxonomy. This is a set taxonomy. Both the text values and numeric codes are accepted.")
    ios_deep_link: Optional[StrictStr] = Field(default=None, description="IOS deep link to the creative assets page.")
    link: Optional[StrictStr] = Field(default=None, description="Link to the creative assets page.")
    title: Optional[StrictStr] = Field(default=None, description="The name of the creative assets.")
    visibility: Optional[StrictStr] = Field(default=None, description="Visibility of the creative assets. Must be one of the following values (upper or lowercase): ‘visible’, ‘hidden’.")
    __properties: ClassVar[List[str]] = ["android_deep_link", "custom_label_0", "custom_label_1", "custom_label_2", "custom_label_3", "custom_label_4", "description", "google_product_category", "ios_deep_link", "link", "title", "visibility"]

    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 CatalogsUpdatableCreativeAssetsAttributes 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,
        )
        # set to None if android_deep_link (nullable) is None
        # and model_fields_set contains the field
        if self.android_deep_link is None and "android_deep_link" in self.model_fields_set:
            _dict['android_deep_link'] = 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 google_product_category (nullable) is None
        # and model_fields_set contains the field
        if self.google_product_category is None and "google_product_category" in self.model_fields_set:
            _dict['google_product_category'] = None

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "android_deep_link": obj.get("android_deep_link"),
            "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"),
            "google_product_category": obj.get("google_product_category"),
            "ios_deep_link": obj.get("ios_deep_link"),
            "link": obj.get("link"),
            "title": obj.get("title"),
            "visibility": obj.get("visibility")
        })
        return _obj


