# 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_asset_property import RecommendationAssetProperty
from openapi_client.models.campaign.recommendation_background import RecommendationBackground
from openapi_client.models.campaign.recommendation_color import RecommendationColor
from openapi_client.models.campaign.recommendation_image import RecommendationImage
from openapi_client.models.campaign.recommendation_text import RecommendationText
from typing_extensions import Self

class RecommendationTemplate(BaseModel):
    """
    RecommendationTemplate
    """ # noqa: E501
    style: Optional[StrictInt] = Field(default=None, alias="style")
    template_id: Optional[StrictStr] = Field(default=None, alias="templateId")
    template_name: Optional[StrictStr] = Field(default=None, alias="templateName")
    version: Optional[StrictStr] = Field(default=None, alias="version")
    image: Optional[RecommendationImage] = Field(default=None, alias="image")
    logo: Optional[RecommendationImage] = Field(default=None, alias="logo")
    business_name: Optional[RecommendationText] = Field(default=None, alias="businessName")
    short_headline: Optional[RecommendationText] = Field(default=None, alias="shortHeadline")
    long_headline: Optional[RecommendationText] = Field(default=None, alias="longHeadline")
    description: Optional[RecommendationText] = Field(default=None, alias="description")
    cta: Optional[RecommendationText] = Field(default=None, alias="cta")
    asset_properties: Optional[List[Optional[RecommendationAssetProperty]]] = Field(default=None, alias="assetProperties")
    background: Optional[RecommendationBackground] = Field(default=None, alias="background")
    color: Optional[List[Optional[RecommendationColor]]] = Field(default=None, alias="color")
    __properties: ClassVar[List[str]] = ["style", "templateId", "templateName", "version", "image", "logo", "businessName", "shortHeadline", "longHeadline", "description", "cta", "assetProperties", "background", "color"]

    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 image
        if self.image:
            _dict['image'] = self.image.to_dict()
        # 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 short_headline
        if self.short_headline:
            _dict['shortHeadline'] = self.short_headline.to_dict()
        # override the default output from pydantic by calling `to_dict()` of long_headline
        if self.long_headline:
            _dict['longHeadline'] = self.long_headline.to_dict()
        # override the default output from pydantic by calling `to_dict()` of description
        if self.description:
            _dict['description'] = self.description.to_dict()
        # override the default output from pydantic by calling `to_dict()` of cta
        if self.cta:
            _dict['cta'] = self.cta.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in asset_properties (list)
        _items = []
        if self.asset_properties:
            for _item_asset_properties in self.asset_properties:
                if _item_asset_properties:
                    _items.append(_item_asset_properties.to_dict())
            _dict['AssetProperties'] = _items
        # override the default output from pydantic by calling `to_dict()` of background
        if self.background:
            _dict['background'] = self.background.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in color (list)
        _items = []
        if self.color:
            for _item_color in self.color:
                if _item_color:
                    _items.append(_item_color.to_dict())
            _dict['Color'] = _items
        # set to None if style (nullable) is None
        # and model_fields_set contains the field
        if self.style is None and "style" in self.model_fields_set:
            _dict['style'] = None

        # 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 template_name (nullable) is None
        # and model_fields_set contains the field
        if self.template_name is None and "template_name" in self.model_fields_set:
            _dict['templateName'] = None

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

        # 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 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 short_headline (nullable) is None
        # and model_fields_set contains the field
        if self.short_headline is None and "short_headline" in self.model_fields_set:
            _dict['shortHeadline'] = None

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "style": obj.get("Style") if obj.get("Style") is not None else None,
                        "templateId": obj.get("TemplateId") if obj.get("TemplateId") is not None else None,
                        "templateName": obj.get("TemplateName") if obj.get("TemplateName") is not None else None,
                        "version": obj.get("Version") if obj.get("Version") is not None else None,
                        "image": RecommendationImage.from_dict(obj["Image"]) if obj.get("Image") is not None else None,
                        "logo": RecommendationImage.from_dict(obj["Logo"]) if obj.get("Logo") is not None else None,
                        "businessName": RecommendationText.from_dict(obj["BusinessName"]) if obj.get("BusinessName") is not None else None,
                        "shortHeadline": RecommendationText.from_dict(obj["ShortHeadline"]) if obj.get("ShortHeadline") is not None else None,
                        "longHeadline": RecommendationText.from_dict(obj["LongHeadline"]) if obj.get("LongHeadline") is not None else None,
                        "description": RecommendationText.from_dict(obj["Description"]) if obj.get("Description") is not None else None,
                        "cta": RecommendationText.from_dict(obj["Cta"]) if obj.get("Cta") is not None else None,
                        "assetProperties": [RecommendationAssetProperty.from_dict(_item) for _item in obj["AssetProperties"]] if obj.get("AssetProperties") is not None else None,
                        "background": RecommendationBackground.from_dict(obj["Background"]) if obj.get("Background") is not None else None,
                        "color": [RecommendationColor.from_dict(_item) for _item in obj["Color"]] if obj.get("Color") is not None else None
        })
        return _obj
