# coding: utf-8

"""
    CampaignManagementService

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0.0
    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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from openapi_client.models.campaign.ad_recommendation_image_suggestion import AdRecommendationImageSuggestion
from openapi_client.models.campaign.ad_recommendation_video_suggestion import AdRecommendationVideoSuggestion
from openapi_client.models.campaign.responsive_ad import ResponsiveAd
from typing_extensions import Self

class CreateResponsiveAdRecommendationResponse(BaseModel):
    """
    CreateResponsiveAdRecommendationResponse
    """ # noqa: E501
    responsive_ad: Optional[ResponsiveAd] = Field(default=None, alias="ResponsiveAd")
    image_suggestions: Optional[List[Optional[AdRecommendationImageSuggestion]]] = Field(default=None, alias="ImageSuggestions")
    video_suggestions: Optional[List[Optional[AdRecommendationVideoSuggestion]]] = Field(default=None, alias="VideoSuggestions")
    prompt_brand_warning: Optional[StrictStr] = Field(default=None, alias="PromptBrandWarning")
    __properties: ClassVar[List[str]] = ["ResponsiveAd", "ImageSuggestions", "VideoSuggestions", "PromptBrandWarning"]

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

    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 responsive_ad
        if self.responsive_ad:
            _dict['ResponsiveAd'] = self.responsive_ad.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in image_suggestions (list)
        _items = []
        if self.image_suggestions:
            for _item_image_suggestions in self.image_suggestions:
                if _item_image_suggestions:
                    _items.append(_item_image_suggestions.to_dict())
            _dict['ImageSuggestions'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in video_suggestions (list)
        _items = []
        if self.video_suggestions:
            for _item_video_suggestions in self.video_suggestions:
                if _item_video_suggestions:
                    _items.append(_item_video_suggestions.to_dict())
            _dict['VideoSuggestions'] = _items
        # set to None if responsive_ad (nullable) is None
        # and model_fields_set contains the field
        if self.responsive_ad is None and "responsive_ad" in self.model_fields_set:
            _dict['ResponsiveAd'] = None

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "ResponsiveAd": ResponsiveAd.from_dict(obj["ResponsiveAd"]) if obj.get("ResponsiveAd") is not None else None,
                        "ImageSuggestions": [AdRecommendationImageSuggestion.from_dict(_item) for _item in obj["ImageSuggestions"]] if obj.get("ImageSuggestions") is not None else None,
                        "VideoSuggestions": [AdRecommendationVideoSuggestion.from_dict(_item) for _item in obj["VideoSuggestions"]] if obj.get("VideoSuggestions") is not None else None,
                        "PromptBrandWarning": obj.get("PromptBrandWarning") if obj.get("PromptBrandWarning") is not None else None
        })
        return _obj
