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

class CatalogsRetailFilterValuesMap(BaseModel):
    """
    A map of filter attributes to their available values.
    """ # noqa: E501
    ad_image_tags: Optional[List[StrictStr]] = None
    ad_video_tags: Optional[List[StrictStr]] = None
    availability: Optional[List[StrictStr]] = None
    brand: Optional[List[StrictStr]] = None
    condition: Optional[List[StrictStr]] = None
    custom_label_0: Optional[List[StrictStr]] = None
    custom_label_1: Optional[List[StrictStr]] = None
    custom_label_2: Optional[List[StrictStr]] = None
    custom_label_3: Optional[List[StrictStr]] = None
    custom_label_4: Optional[List[StrictStr]] = None
    gender: Optional[List[StrictStr]] = None
    google_product_category_0: Optional[List[StrictStr]] = None
    google_product_category_1: Optional[List[StrictStr]] = None
    google_product_category_2: Optional[List[StrictStr]] = None
    google_product_category_3: Optional[List[StrictStr]] = None
    google_product_category_4: Optional[List[StrictStr]] = None
    google_product_category_5: Optional[List[StrictStr]] = None
    google_product_category_6: Optional[List[StrictStr]] = None
    media_type: Optional[List[StrictStr]] = None
    product_type_0: Optional[List[StrictStr]] = None
    product_type_1: Optional[List[StrictStr]] = None
    product_type_2: Optional[List[StrictStr]] = None
    product_type_3: Optional[List[StrictStr]] = None
    product_type_4: Optional[List[StrictStr]] = None
    __properties: ClassVar[List[str]] = ["ad_image_tags", "ad_video_tags", "availability", "brand", "condition", "custom_label_0", "custom_label_1", "custom_label_2", "custom_label_3", "custom_label_4", "gender", "google_product_category_0", "google_product_category_1", "google_product_category_2", "google_product_category_3", "google_product_category_4", "google_product_category_5", "google_product_category_6", "media_type", "product_type_0", "product_type_1", "product_type_2", "product_type_3", "product_type_4"]

    @field_validator('availability')
    def availability_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['IN_STOCK', 'OUT_OF_STOCK', 'PREORDER', 'UNAVAILABLE']):
                raise ValueError("each list item must be one of ('IN_STOCK', 'OUT_OF_STOCK', 'PREORDER', 'UNAVAILABLE')")
        return value

    @field_validator('condition')
    def condition_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['NEW', 'USED', 'REFURBISHED']):
                raise ValueError("each list item must be one of ('NEW', 'USED', 'REFURBISHED')")
        return value

    @field_validator('gender')
    def gender_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['FEMALE', 'MALE', 'UNISEX']):
                raise ValueError("each list item must be one of ('FEMALE', 'MALE', 'UNISEX')")
        return value

    @field_validator('media_type')
    def media_type_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['IMAGE', 'VIDEO']):
                raise ValueError("each list item must be one of ('IMAGE', 'VIDEO')")
        return value

    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 CatalogsRetailFilterValuesMap 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "ad_image_tags": obj.get("ad_image_tags"),
            "ad_video_tags": obj.get("ad_video_tags"),
            "availability": obj.get("availability"),
            "brand": obj.get("brand"),
            "condition": obj.get("condition"),
            "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"),
            "gender": obj.get("gender"),
            "google_product_category_0": obj.get("google_product_category_0"),
            "google_product_category_1": obj.get("google_product_category_1"),
            "google_product_category_2": obj.get("google_product_category_2"),
            "google_product_category_3": obj.get("google_product_category_3"),
            "google_product_category_4": obj.get("google_product_category_4"),
            "google_product_category_5": obj.get("google_product_category_5"),
            "google_product_category_6": obj.get("google_product_category_6"),
            "media_type": obj.get("media_type"),
            "product_type_0": obj.get("product_type_0"),
            "product_type_1": obj.get("product_type_1"),
            "product_type_2": obj.get("product_type_2"),
            "product_type_3": obj.get("product_type_3"),
            "product_type_4": obj.get("product_type_4")
        })
        return _obj


