# 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.recommendation_audio import RecommendationAudio
from openapi_client.models.campaign.recommendation_business_name import RecommendationBusinessName
from openapi_client.models.campaign.recommendation_logo import RecommendationLogo
from openapi_client.models.campaign.recommendation_scene import RecommendationScene
from openapi_client.models.campaign.solid_background_asset import SolidBackgroundAsset
from typing_extensions import Self

class RecommendationTemplateVideo(BaseModel):
    """
    RecommendationTemplateVideo
    """ # noqa: E501
    template_id: Optional[StrictStr] = Field(default=None, alias="templateId")
    logo: Optional[RecommendationLogo] = Field(default=None, alias="logo")
    business_name: Optional[RecommendationBusinessName] = Field(default=None, alias="businessName")
    duration: Optional[StrictInt] = Field(default=None, alias="duration")
    audio: Optional[RecommendationAudio] = Field(default=None, alias="audio")
    width: Optional[StrictInt] = Field(default=None, alias="width")
    height: Optional[StrictInt] = Field(default=None, alias="height")
    background_color: Optional[SolidBackgroundAsset] = Field(default=None, alias="backgroundColor")
    scenes: Optional[List[Optional[RecommendationScene]]] = Field(default=None, alias="scenes")
    __properties: ClassVar[List[str]] = ["templateId", "logo", "businessName", "duration", "audio", "width", "height", "backgroundColor", "scenes"]

    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 logo
        if self.logo:
            _dict['logo'] = self.logo.to_dict()
        # override the default output from pydantic by calling `to_dict()` of business_name
        if self.business_name:
            _dict['businessName'] = self.business_name.to_dict()
        # override the default output from pydantic by calling `to_dict()` of audio
        if self.audio:
            _dict['audio'] = self.audio.to_dict()
        # override the default output from pydantic by calling `to_dict()` of background_color
        if self.background_color:
            _dict['backgroundColor'] = self.background_color.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in scenes (list)
        _items = []
        if self.scenes:
            for _item_scenes in self.scenes:
                if _item_scenes:
                    _items.append(_item_scenes.to_dict())
            _dict['Scenes'] = _items
        # set to None if template_id (nullable) is None
        # and model_fields_set contains the field
        if self.template_id is None and "template_id" in self.model_fields_set:
            _dict['templateId'] = None

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "templateId": obj.get("TemplateId") if obj.get("TemplateId") is not None else None,
                        "logo": RecommendationLogo.from_dict(obj["Logo"]) if obj.get("Logo") is not None else None,
                        "businessName": RecommendationBusinessName.from_dict(obj["BusinessName"]) if obj.get("BusinessName") is not None else None,
                        "duration": obj.get("Duration") if obj.get("Duration") is not None else None,
                        "audio": RecommendationAudio.from_dict(obj["Audio"]) if obj.get("Audio") is not None else None,
                        "width": obj.get("Width") if obj.get("Width") is not None else None,
                        "height": obj.get("Height") if obj.get("Height") is not None else None,
                        "backgroundColor": SolidBackgroundAsset.from_dict(obj["BackgroundColor"]) if obj.get("BackgroundColor") is not None else None,
                        "scenes": [RecommendationScene.from_dict(_item) for _item in obj["Scenes"]] if obj.get("Scenes") is not None else None
        })
        return _obj
