# 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
from inspect import getfullargspec
import json
import pprint
import re  # noqa: F401
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Optional
from pinterestsdk.models.availability_filter import AvailabilityFilter
from pinterestsdk.models.brand_filter import BrandFilter
from pinterestsdk.models.condition_filter import ConditionFilter
from pinterestsdk.models.currency_filter import CurrencyFilter
from pinterestsdk.models.custom_label0_filter import CustomLabel0Filter
from pinterestsdk.models.custom_label1_filter import CustomLabel1Filter
from pinterestsdk.models.custom_label2_filter import CustomLabel2Filter
from pinterestsdk.models.custom_label3_filter import CustomLabel3Filter
from pinterestsdk.models.custom_label4_filter import CustomLabel4Filter
from pinterestsdk.models.custom_number0_filter import CustomNumber0Filter
from pinterestsdk.models.custom_number1_filter import CustomNumber1Filter
from pinterestsdk.models.custom_number2_filter import CustomNumber2Filter
from pinterestsdk.models.custom_number3_filter import CustomNumber3Filter
from pinterestsdk.models.custom_number4_filter import CustomNumber4Filter
from pinterestsdk.models.gender_filter import GenderFilter
from pinterestsdk.models.google_product_category0_filter import GoogleProductCategory0Filter
from pinterestsdk.models.google_product_category1_filter import GoogleProductCategory1Filter
from pinterestsdk.models.google_product_category2_filter import GoogleProductCategory2Filter
from pinterestsdk.models.google_product_category3_filter import GoogleProductCategory3Filter
from pinterestsdk.models.google_product_category4_filter import GoogleProductCategory4Filter
from pinterestsdk.models.google_product_category5_filter import GoogleProductCategory5Filter
from pinterestsdk.models.google_product_category6_filter import GoogleProductCategory6Filter
from pinterestsdk.models.item_group_id_filter import ItemGroupIdFilter
from pinterestsdk.models.item_id_filter import ItemIdFilter
from pinterestsdk.models.max_price_filter import MaxPriceFilter
from pinterestsdk.models.media_type_filter import MediaTypeFilter
from pinterestsdk.models.min_price_filter import MinPriceFilter
from pinterestsdk.models.product_group_reference_filter import ProductGroupReferenceFilter
from pinterestsdk.models.product_type0_filter import ProductType0Filter
from pinterestsdk.models.product_type1_filter import ProductType1Filter
from pinterestsdk.models.product_type2_filter import ProductType2Filter
from pinterestsdk.models.product_type3_filter import ProductType3Filter
from pinterestsdk.models.product_type4_filter import ProductType4Filter
from pinterestsdk.models.title_keywords_filter import TitleKeywordsFilter
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
from typing_extensions import Literal, Self
from pydantic import Field

CATALOGSPRODUCTGROUPFILTERKEYS_ANY_OF_SCHEMAS = ["AvailabilityFilter", "BrandFilter", "ConditionFilter", "CurrencyFilter", "CustomLabel0Filter", "CustomLabel1Filter", "CustomLabel2Filter", "CustomLabel3Filter", "CustomLabel4Filter", "CustomNumber0Filter", "CustomNumber1Filter", "CustomNumber2Filter", "CustomNumber3Filter", "CustomNumber4Filter", "GenderFilter", "GoogleProductCategory0Filter", "GoogleProductCategory1Filter", "GoogleProductCategory2Filter", "GoogleProductCategory3Filter", "GoogleProductCategory4Filter", "GoogleProductCategory5Filter", "GoogleProductCategory6Filter", "ItemGroupIdFilter", "ItemIdFilter", "MaxPriceFilter", "MediaTypeFilter", "MinPriceFilter", "ProductGroupReferenceFilter", "ProductType0Filter", "ProductType1Filter", "ProductType2Filter", "ProductType3Filter", "ProductType4Filter", "TitleKeywordsFilter"]

class CatalogsProductGroupFilterKeys(BaseModel):
    """
    CatalogsProductGroupFilterKeys
    """

    # data type: MinPriceFilter
    anyof_schema_1_validator: Optional[MinPriceFilter] = None
    # data type: MaxPriceFilter
    anyof_schema_2_validator: Optional[MaxPriceFilter] = None
    # data type: CurrencyFilter
    anyof_schema_3_validator: Optional[CurrencyFilter] = None
    # data type: ItemIdFilter
    anyof_schema_4_validator: Optional[ItemIdFilter] = None
    # data type: AvailabilityFilter
    anyof_schema_5_validator: Optional[AvailabilityFilter] = None
    # data type: BrandFilter
    anyof_schema_6_validator: Optional[BrandFilter] = None
    # data type: ConditionFilter
    anyof_schema_7_validator: Optional[ConditionFilter] = None
    # data type: CustomLabel0Filter
    anyof_schema_8_validator: Optional[CustomLabel0Filter] = None
    # data type: CustomLabel1Filter
    anyof_schema_9_validator: Optional[CustomLabel1Filter] = None
    # data type: CustomLabel2Filter
    anyof_schema_10_validator: Optional[CustomLabel2Filter] = None
    # data type: CustomLabel3Filter
    anyof_schema_11_validator: Optional[CustomLabel3Filter] = None
    # data type: CustomLabel4Filter
    anyof_schema_12_validator: Optional[CustomLabel4Filter] = None
    # data type: ItemGroupIdFilter
    anyof_schema_13_validator: Optional[ItemGroupIdFilter] = None
    # data type: GenderFilter
    anyof_schema_14_validator: Optional[GenderFilter] = None
    # data type: MediaTypeFilter
    anyof_schema_15_validator: Optional[MediaTypeFilter] = None
    # data type: ProductType4Filter
    anyof_schema_16_validator: Optional[ProductType4Filter] = None
    # data type: ProductType3Filter
    anyof_schema_17_validator: Optional[ProductType3Filter] = None
    # data type: ProductType2Filter
    anyof_schema_18_validator: Optional[ProductType2Filter] = None
    # data type: ProductType1Filter
    anyof_schema_19_validator: Optional[ProductType1Filter] = None
    # data type: ProductType0Filter
    anyof_schema_20_validator: Optional[ProductType0Filter] = None
    # data type: GoogleProductCategory6Filter
    anyof_schema_21_validator: Optional[GoogleProductCategory6Filter] = None
    # data type: GoogleProductCategory5Filter
    anyof_schema_22_validator: Optional[GoogleProductCategory5Filter] = None
    # data type: GoogleProductCategory4Filter
    anyof_schema_23_validator: Optional[GoogleProductCategory4Filter] = None
    # data type: GoogleProductCategory3Filter
    anyof_schema_24_validator: Optional[GoogleProductCategory3Filter] = None
    # data type: GoogleProductCategory2Filter
    anyof_schema_25_validator: Optional[GoogleProductCategory2Filter] = None
    # data type: GoogleProductCategory1Filter
    anyof_schema_26_validator: Optional[GoogleProductCategory1Filter] = None
    # data type: GoogleProductCategory0Filter
    anyof_schema_27_validator: Optional[GoogleProductCategory0Filter] = None
    # data type: ProductGroupReferenceFilter
    anyof_schema_28_validator: Optional[ProductGroupReferenceFilter] = None
    # data type: CustomNumber0Filter
    anyof_schema_29_validator: Optional[CustomNumber0Filter] = None
    # data type: CustomNumber1Filter
    anyof_schema_30_validator: Optional[CustomNumber1Filter] = None
    # data type: CustomNumber2Filter
    anyof_schema_31_validator: Optional[CustomNumber2Filter] = None
    # data type: CustomNumber3Filter
    anyof_schema_32_validator: Optional[CustomNumber3Filter] = None
    # data type: CustomNumber4Filter
    anyof_schema_33_validator: Optional[CustomNumber4Filter] = None
    # data type: TitleKeywordsFilter
    anyof_schema_34_validator: Optional[TitleKeywordsFilter] = None
    if TYPE_CHECKING:
        actual_instance: Optional[Union[AvailabilityFilter, BrandFilter, ConditionFilter, CurrencyFilter, CustomLabel0Filter, CustomLabel1Filter, CustomLabel2Filter, CustomLabel3Filter, CustomLabel4Filter, CustomNumber0Filter, CustomNumber1Filter, CustomNumber2Filter, CustomNumber3Filter, CustomNumber4Filter, GenderFilter, GoogleProductCategory0Filter, GoogleProductCategory1Filter, GoogleProductCategory2Filter, GoogleProductCategory3Filter, GoogleProductCategory4Filter, GoogleProductCategory5Filter, GoogleProductCategory6Filter, ItemGroupIdFilter, ItemIdFilter, MaxPriceFilter, MediaTypeFilter, MinPriceFilter, ProductGroupReferenceFilter, ProductType0Filter, ProductType1Filter, ProductType2Filter, ProductType3Filter, ProductType4Filter, TitleKeywordsFilter]] = None
    else:
        actual_instance: Any = None
    any_of_schemas: Set[str] = { "AvailabilityFilter", "BrandFilter", "ConditionFilter", "CurrencyFilter", "CustomLabel0Filter", "CustomLabel1Filter", "CustomLabel2Filter", "CustomLabel3Filter", "CustomLabel4Filter", "CustomNumber0Filter", "CustomNumber1Filter", "CustomNumber2Filter", "CustomNumber3Filter", "CustomNumber4Filter", "GenderFilter", "GoogleProductCategory0Filter", "GoogleProductCategory1Filter", "GoogleProductCategory2Filter", "GoogleProductCategory3Filter", "GoogleProductCategory4Filter", "GoogleProductCategory5Filter", "GoogleProductCategory6Filter", "ItemGroupIdFilter", "ItemIdFilter", "MaxPriceFilter", "MediaTypeFilter", "MinPriceFilter", "ProductGroupReferenceFilter", "ProductType0Filter", "ProductType1Filter", "ProductType2Filter", "ProductType3Filter", "ProductType4Filter", "TitleKeywordsFilter" }

    model_config = {
        "validate_assignment": True,
        "protected_namespaces": (),
    }

    def __init__(self, *args, **kwargs) -> None:
        if args:
            if len(args) > 1:
                raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
            if kwargs:
                raise ValueError("If a position argument is used, keyword arguments cannot be used.")
            super().__init__(actual_instance=args[0])
        else:
            super().__init__(**kwargs)

    @field_validator('actual_instance')
    def actual_instance_must_validate_anyof(cls, v):
        instance = CatalogsProductGroupFilterKeys.model_construct()
        error_messages = []
        # validate data type: MinPriceFilter
        if not isinstance(v, MinPriceFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `MinPriceFilter`")
        else:
            return v

        # validate data type: MaxPriceFilter
        if not isinstance(v, MaxPriceFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `MaxPriceFilter`")
        else:
            return v

        # validate data type: CurrencyFilter
        if not isinstance(v, CurrencyFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CurrencyFilter`")
        else:
            return v

        # validate data type: ItemIdFilter
        if not isinstance(v, ItemIdFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ItemIdFilter`")
        else:
            return v

        # validate data type: AvailabilityFilter
        if not isinstance(v, AvailabilityFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `AvailabilityFilter`")
        else:
            return v

        # validate data type: BrandFilter
        if not isinstance(v, BrandFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `BrandFilter`")
        else:
            return v

        # validate data type: ConditionFilter
        if not isinstance(v, ConditionFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ConditionFilter`")
        else:
            return v

        # validate data type: CustomLabel0Filter
        if not isinstance(v, CustomLabel0Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomLabel0Filter`")
        else:
            return v

        # validate data type: CustomLabel1Filter
        if not isinstance(v, CustomLabel1Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomLabel1Filter`")
        else:
            return v

        # validate data type: CustomLabel2Filter
        if not isinstance(v, CustomLabel2Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomLabel2Filter`")
        else:
            return v

        # validate data type: CustomLabel3Filter
        if not isinstance(v, CustomLabel3Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomLabel3Filter`")
        else:
            return v

        # validate data type: CustomLabel4Filter
        if not isinstance(v, CustomLabel4Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomLabel4Filter`")
        else:
            return v

        # validate data type: ItemGroupIdFilter
        if not isinstance(v, ItemGroupIdFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ItemGroupIdFilter`")
        else:
            return v

        # validate data type: GenderFilter
        if not isinstance(v, GenderFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GenderFilter`")
        else:
            return v

        # validate data type: MediaTypeFilter
        if not isinstance(v, MediaTypeFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `MediaTypeFilter`")
        else:
            return v

        # validate data type: ProductType4Filter
        if not isinstance(v, ProductType4Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ProductType4Filter`")
        else:
            return v

        # validate data type: ProductType3Filter
        if not isinstance(v, ProductType3Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ProductType3Filter`")
        else:
            return v

        # validate data type: ProductType2Filter
        if not isinstance(v, ProductType2Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ProductType2Filter`")
        else:
            return v

        # validate data type: ProductType1Filter
        if not isinstance(v, ProductType1Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ProductType1Filter`")
        else:
            return v

        # validate data type: ProductType0Filter
        if not isinstance(v, ProductType0Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ProductType0Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory6Filter
        if not isinstance(v, GoogleProductCategory6Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory6Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory5Filter
        if not isinstance(v, GoogleProductCategory5Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory5Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory4Filter
        if not isinstance(v, GoogleProductCategory4Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory4Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory3Filter
        if not isinstance(v, GoogleProductCategory3Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory3Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory2Filter
        if not isinstance(v, GoogleProductCategory2Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory2Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory1Filter
        if not isinstance(v, GoogleProductCategory1Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory1Filter`")
        else:
            return v

        # validate data type: GoogleProductCategory0Filter
        if not isinstance(v, GoogleProductCategory0Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GoogleProductCategory0Filter`")
        else:
            return v

        # validate data type: ProductGroupReferenceFilter
        if not isinstance(v, ProductGroupReferenceFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ProductGroupReferenceFilter`")
        else:
            return v

        # validate data type: CustomNumber0Filter
        if not isinstance(v, CustomNumber0Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomNumber0Filter`")
        else:
            return v

        # validate data type: CustomNumber1Filter
        if not isinstance(v, CustomNumber1Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomNumber1Filter`")
        else:
            return v

        # validate data type: CustomNumber2Filter
        if not isinstance(v, CustomNumber2Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomNumber2Filter`")
        else:
            return v

        # validate data type: CustomNumber3Filter
        if not isinstance(v, CustomNumber3Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomNumber3Filter`")
        else:
            return v

        # validate data type: CustomNumber4Filter
        if not isinstance(v, CustomNumber4Filter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CustomNumber4Filter`")
        else:
            return v

        # validate data type: TitleKeywordsFilter
        if not isinstance(v, TitleKeywordsFilter):
            error_messages.append(f"Error! Input type `{type(v)}` is not `TitleKeywordsFilter`")
        else:
            return v

        if error_messages:
            # no match
            raise ValueError("No match found when setting the actual_instance in CatalogsProductGroupFilterKeys with anyOf schemas: AvailabilityFilter, BrandFilter, ConditionFilter, CurrencyFilter, CustomLabel0Filter, CustomLabel1Filter, CustomLabel2Filter, CustomLabel3Filter, CustomLabel4Filter, CustomNumber0Filter, CustomNumber1Filter, CustomNumber2Filter, CustomNumber3Filter, CustomNumber4Filter, GenderFilter, GoogleProductCategory0Filter, GoogleProductCategory1Filter, GoogleProductCategory2Filter, GoogleProductCategory3Filter, GoogleProductCategory4Filter, GoogleProductCategory5Filter, GoogleProductCategory6Filter, ItemGroupIdFilter, ItemIdFilter, MaxPriceFilter, MediaTypeFilter, MinPriceFilter, ProductGroupReferenceFilter, ProductType0Filter, ProductType1Filter, ProductType2Filter, ProductType3Filter, ProductType4Filter, TitleKeywordsFilter. Details: " + ", ".join(error_messages))
        else:
            return v

    @classmethod
    def from_dict(cls, obj: Dict[str, Any]) -> Self:
        return cls.from_json(json.dumps(obj))

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Returns the object represented by the json string"""
        instance = cls.model_construct()
        error_messages = []
        # anyof_schema_1_validator: Optional[MinPriceFilter] = None
        try:
            instance.actual_instance = MinPriceFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_2_validator: Optional[MaxPriceFilter] = None
        try:
            instance.actual_instance = MaxPriceFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_3_validator: Optional[CurrencyFilter] = None
        try:
            instance.actual_instance = CurrencyFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_4_validator: Optional[ItemIdFilter] = None
        try:
            instance.actual_instance = ItemIdFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_5_validator: Optional[AvailabilityFilter] = None
        try:
            instance.actual_instance = AvailabilityFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_6_validator: Optional[BrandFilter] = None
        try:
            instance.actual_instance = BrandFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_7_validator: Optional[ConditionFilter] = None
        try:
            instance.actual_instance = ConditionFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_8_validator: Optional[CustomLabel0Filter] = None
        try:
            instance.actual_instance = CustomLabel0Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_9_validator: Optional[CustomLabel1Filter] = None
        try:
            instance.actual_instance = CustomLabel1Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_10_validator: Optional[CustomLabel2Filter] = None
        try:
            instance.actual_instance = CustomLabel2Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_11_validator: Optional[CustomLabel3Filter] = None
        try:
            instance.actual_instance = CustomLabel3Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_12_validator: Optional[CustomLabel4Filter] = None
        try:
            instance.actual_instance = CustomLabel4Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_13_validator: Optional[ItemGroupIdFilter] = None
        try:
            instance.actual_instance = ItemGroupIdFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_14_validator: Optional[GenderFilter] = None
        try:
            instance.actual_instance = GenderFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_15_validator: Optional[MediaTypeFilter] = None
        try:
            instance.actual_instance = MediaTypeFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_16_validator: Optional[ProductType4Filter] = None
        try:
            instance.actual_instance = ProductType4Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_17_validator: Optional[ProductType3Filter] = None
        try:
            instance.actual_instance = ProductType3Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_18_validator: Optional[ProductType2Filter] = None
        try:
            instance.actual_instance = ProductType2Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_19_validator: Optional[ProductType1Filter] = None
        try:
            instance.actual_instance = ProductType1Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_20_validator: Optional[ProductType0Filter] = None
        try:
            instance.actual_instance = ProductType0Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_21_validator: Optional[GoogleProductCategory6Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory6Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_22_validator: Optional[GoogleProductCategory5Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory5Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_23_validator: Optional[GoogleProductCategory4Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory4Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_24_validator: Optional[GoogleProductCategory3Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory3Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_25_validator: Optional[GoogleProductCategory2Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory2Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_26_validator: Optional[GoogleProductCategory1Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory1Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_27_validator: Optional[GoogleProductCategory0Filter] = None
        try:
            instance.actual_instance = GoogleProductCategory0Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_28_validator: Optional[ProductGroupReferenceFilter] = None
        try:
            instance.actual_instance = ProductGroupReferenceFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_29_validator: Optional[CustomNumber0Filter] = None
        try:
            instance.actual_instance = CustomNumber0Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_30_validator: Optional[CustomNumber1Filter] = None
        try:
            instance.actual_instance = CustomNumber1Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_31_validator: Optional[CustomNumber2Filter] = None
        try:
            instance.actual_instance = CustomNumber2Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_32_validator: Optional[CustomNumber3Filter] = None
        try:
            instance.actual_instance = CustomNumber3Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_33_validator: Optional[CustomNumber4Filter] = None
        try:
            instance.actual_instance = CustomNumber4Filter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))
        # anyof_schema_34_validator: Optional[TitleKeywordsFilter] = None
        try:
            instance.actual_instance = TitleKeywordsFilter.from_json(json_str)
            return instance
        except (ValidationError, ValueError) as e:
             error_messages.append(str(e))

        if error_messages:
            # no match
            raise ValueError("No match found when deserializing the JSON string into CatalogsProductGroupFilterKeys with anyOf schemas: AvailabilityFilter, BrandFilter, ConditionFilter, CurrencyFilter, CustomLabel0Filter, CustomLabel1Filter, CustomLabel2Filter, CustomLabel3Filter, CustomLabel4Filter, CustomNumber0Filter, CustomNumber1Filter, CustomNumber2Filter, CustomNumber3Filter, CustomNumber4Filter, GenderFilter, GoogleProductCategory0Filter, GoogleProductCategory1Filter, GoogleProductCategory2Filter, GoogleProductCategory3Filter, GoogleProductCategory4Filter, GoogleProductCategory5Filter, GoogleProductCategory6Filter, ItemGroupIdFilter, ItemIdFilter, MaxPriceFilter, MediaTypeFilter, MinPriceFilter, ProductGroupReferenceFilter, ProductType0Filter, ProductType1Filter, ProductType2Filter, ProductType3Filter, ProductType4Filter, TitleKeywordsFilter. Details: " + ", ".join(error_messages))
        else:
            return instance

    def to_json(self) -> str:
        """Returns the JSON representation of the actual instance"""
        if self.actual_instance is None:
            return "null"

        if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
            return self.actual_instance.to_json()
        else:
            return json.dumps(self.actual_instance)

    def to_dict(self) -> Optional[Union[Dict[str, Any], AvailabilityFilter, BrandFilter, ConditionFilter, CurrencyFilter, CustomLabel0Filter, CustomLabel1Filter, CustomLabel2Filter, CustomLabel3Filter, CustomLabel4Filter, CustomNumber0Filter, CustomNumber1Filter, CustomNumber2Filter, CustomNumber3Filter, CustomNumber4Filter, GenderFilter, GoogleProductCategory0Filter, GoogleProductCategory1Filter, GoogleProductCategory2Filter, GoogleProductCategory3Filter, GoogleProductCategory4Filter, GoogleProductCategory5Filter, GoogleProductCategory6Filter, ItemGroupIdFilter, ItemIdFilter, MaxPriceFilter, MediaTypeFilter, MinPriceFilter, ProductGroupReferenceFilter, ProductType0Filter, ProductType1Filter, ProductType2Filter, ProductType3Filter, ProductType4Filter, TitleKeywordsFilter]]:
        """Returns the dict representation of the actual instance"""
        if self.actual_instance is None:
            return None

        if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
            return self.actual_instance.to_dict()
        else:
            return self.actual_instance

    def to_str(self) -> str:
        """Returns the string representation of the actual instance"""
        return pprint.pformat(self.model_dump())


