# 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.key_frame import KeyFrame
from openapi_client.models.campaign.video_recommendation_image_data import VideoRecommendationImageData
from openapi_client.models.campaign.video_recommendation_text_data import VideoRecommendationTextData
from typing_extensions import Self

class RecommendationScene(BaseModel):
    """
    RecommendationScene
    """ # noqa: E501
    image: Optional[StrictStr] = Field(default=None, alias="image")
    images: Optional[List[StrictStr]] = Field(default=None, alias="images")
    image_data: Optional[List[Optional[VideoRecommendationImageData]]] = Field(default=None, alias="imageData")
    text: Optional[List[StrictStr]] = Field(default=None, alias="text")
    text_data: Optional[List[Optional[VideoRecommendationTextData]]] = Field(default=None, alias="textData")
    logos: Optional[List[StrictStr]] = Field(default=None, alias="logos")
    logo_data: Optional[List[Optional[VideoRecommendationImageData]]] = Field(default=None, alias="logoData")
    key_frame: Optional[KeyFrame] = Field(default=None, alias="keyFrame")
    __properties: ClassVar[List[str]] = ["image", "images", "imageData", "text", "textData", "logos", "logoData", "keyFrame"]

    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 each item in image_data (list)
        _items = []
        if self.image_data:
            for _item_image_data in self.image_data:
                if _item_image_data:
                    _items.append(_item_image_data.to_dict())
            _dict['ImageData'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in text_data (list)
        _items = []
        if self.text_data:
            for _item_text_data in self.text_data:
                if _item_text_data:
                    _items.append(_item_text_data.to_dict())
            _dict['TextData'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in logo_data (list)
        _items = []
        if self.logo_data:
            for _item_logo_data in self.logo_data:
                if _item_logo_data:
                    _items.append(_item_logo_data.to_dict())
            _dict['LogoData'] = _items
        # override the default output from pydantic by calling `to_dict()` of key_frame
        if self.key_frame:
            _dict['keyFrame'] = self.key_frame.to_dict()
        # set to None if image (nullable) is None
        # and model_fields_set contains the field
        if self.image is None and "image" in self.model_fields_set:
            _dict['image'] = None

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "image": obj.get("Image") if obj.get("Image") is not None else None,
                        "images": obj.get("Images"),
                        "imageData": [VideoRecommendationImageData.from_dict(_item) for _item in obj["ImageData"]] if obj.get("ImageData") is not None else None,
                        "text": obj.get("Text"),
                        "textData": [VideoRecommendationTextData.from_dict(_item) for _item in obj["TextData"]] if obj.get("TextData") is not None else None,
                        "logos": obj.get("Logos"),
                        "logoData": [VideoRecommendationImageData.from_dict(_item) for _item in obj["LogoData"]] if obj.get("LogoData") is not None else None,
                        "keyFrame": KeyFrame.from_dict(obj["KeyFrame"]) if obj.get("KeyFrame") is not None else None
        })
        return _obj
