# 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_metadata import AdRecommendationImageSuggestionMetadata
from openapi_client.models.campaign.asset_link import AssetLink
from openapi_client.models.campaign.image import Image
from openapi_client.models.campaign.recommendation_template import RecommendationTemplate
from typing_extensions import Self

class AdRecommendationImageSuggestion(BaseModel):
    """
    AdRecommendationImageSuggestion
    """ # noqa: E501
    image: Optional[Image] = Field(default=None, alias="Image")
    image_url: Optional[StrictStr] = Field(default=None, alias="ImageUrl")
    asset_link: Optional[AssetLink] = Field(default=None, alias="AssetLink")
    image_metadata: Optional[AdRecommendationImageSuggestionMetadata] = Field(default=None, alias="ImageMetadata")
    internal_template: Optional[RecommendationTemplate] = Field(default=None, alias="Internal_Template")
    __properties: ClassVar[List[str]] = ["Image", "ImageUrl", "AssetLink", "ImageMetadata", "Internal_Template"]

    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 asset_link
        if self.asset_link:
            _dict['AssetLink'] = self.asset_link.to_dict()
        # override the default output from pydantic by calling `to_dict()` of image_metadata
        if self.image_metadata:
            _dict['ImageMetadata'] = self.image_metadata.to_dict()
        # override the default output from pydantic by calling `to_dict()` of internal_template
        if self.internal_template:
            _dict['Internal_Template'] = self.internal_template.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 image_url (nullable) is None
        # and model_fields_set contains the field
        if self.image_url is None and "image_url" in self.model_fields_set:
            _dict['ImageUrl'] = None

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Image": Image.from_dict(obj["Image"]) if obj.get("Image") is not None else None,
                        "ImageUrl": obj.get("ImageUrl") if obj.get("ImageUrl") is not None else None,
                        "AssetLink": AssetLink.from_dict(obj["AssetLink"]) if obj.get("AssetLink") is not None else None,
                        "ImageMetadata": AdRecommendationImageSuggestionMetadata.from_dict(obj["ImageMetadata"]) if obj.get("ImageMetadata") is not None else None,
                        "Internal_Template": RecommendationTemplate.from_dict(obj["InternalTemplate"]) if obj.get("InternalTemplate") is not None else None
        })
        return _obj
