# coding: utf-8

"""
    AdInsightService

    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.adinsight.suggested_responsive_search_ad import SuggestedResponsiveSearchAd
from typing_extensions import Self

class ResponsiveSearchAdAssetRecommendation(BaseModel):
    """
    ResponsiveSearchAdAssetRecommendation
    """ # noqa: E501
    responsive_search_ad_id: Optional[StrictStr] = Field(default=None, alias="ResponsiveSearchAdId")
    recommended_responsive_search_ad: Optional[SuggestedResponsiveSearchAd] = Field(default=None, alias="RecommendedResponsiveSearchAd")
    account_id: Optional[StrictStr] = Field(default=None, alias="AccountId")
    account_name: Optional[StrictStr] = Field(default=None, alias="AccountName")
    campaign_id: Optional[StrictStr] = Field(default=None, alias="CampaignId")
    campaign_name: Optional[StrictStr] = Field(default=None, alias="CampaignName")
    ad_group_id: Optional[StrictStr] = Field(default=None, alias="AdGroupId")
    ad_group_name: Optional[StrictStr] = Field(default=None, alias="AdGroupName")
    recommendation_type: Optional[StrictStr] = Field(default=None, alias="RecommendationType")
    type: Optional[StrictStr] = Field(default='ResponsiveSearchAdAssetRecommendation', alias="Type")
    recommendation_id: Optional[StrictStr] = Field(default=None, alias="RecommendationId")
    recommendation_hash: Optional[StrictStr] = Field(default=None, alias="RecommendationHash")
    current_clicks: Optional[StrictStr] = Field(default=None, alias="CurrentClicks")
    estimated_increase_in_clicks: Optional[StrictStr] = Field(default=None, alias="EstimatedIncreaseInClicks")
    current_cost: Optional[StrictFloat] = Field(default=None, alias="CurrentCost")
    estimated_increase_in_cost: Optional[StrictFloat] = Field(default=None, alias="EstimatedIncreaseInCost")
    current_impressions: Optional[StrictStr] = Field(default=None, alias="CurrentImpressions")
    estimated_increase_in_impressions: Optional[StrictStr] = Field(default=None, alias="EstimatedIncreaseInImpressions")
    current_conversions: Optional[StrictStr] = Field(default=None, alias="CurrentConversions")
    estimated_increase_in_conversions: Optional[StrictStr] = Field(default=None, alias="EstimatedIncreaseInConversions")
    dismissed: Optional[StrictBool] = Field(default=None, alias="Dismissed")
    __properties: ClassVar[List[str]] = ["ResponsiveSearchAdId", "RecommendedResponsiveSearchAd", "AccountId", "AccountName", "CampaignId", "CampaignName", "AdGroupId", "AdGroupName", "RecommendationType", "Type", "RecommendationId", "RecommendationHash", "CurrentClicks", "EstimatedIncreaseInClicks", "CurrentCost", "EstimatedIncreaseInCost", "CurrentImpressions", "EstimatedIncreaseInImpressions", "CurrentConversions", "EstimatedIncreaseInConversions", "Dismissed"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )
	
    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())
	
    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of ResponsiveSearchAdAssetRecommendation from a JSON string"""
        return cls.from_dict(json.loads(json_str))
	

    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 recommended_responsive_search_ad
        if self.recommended_responsive_search_ad:
            _dict['RecommendedResponsiveSearchAd'] = self.recommended_responsive_search_ad.to_dict()
        # set to None if responsive_search_ad_id (nullable) is None
        # and model_fields_set contains the field
        if self.responsive_search_ad_id is None and "responsive_search_ad_id" in self.model_fields_set:
            _dict['ResponsiveSearchAdId'] = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "ResponsiveSearchAdId": obj.get("ResponsiveSearchAdId") if obj.get("ResponsiveSearchAdId") is not None else None,
                        "RecommendedResponsiveSearchAd": SuggestedResponsiveSearchAd.from_dict(obj["RecommendedResponsiveSearchAd"]) if obj.get("RecommendedResponsiveSearchAd") is not None else None,
                        "AccountId": obj.get("AccountId") if obj.get("AccountId") is not None else None,
                        "AccountName": obj.get("AccountName") if obj.get("AccountName") is not None else None,
                        "CampaignId": obj.get("CampaignId") if obj.get("CampaignId") is not None else None,
                        "CampaignName": obj.get("CampaignName") if obj.get("CampaignName") is not None else None,
                        "AdGroupId": obj.get("AdGroupId") if obj.get("AdGroupId") is not None else None,
                        "AdGroupName": obj.get("AdGroupName") if obj.get("AdGroupName") is not None else None,
                        "RecommendationType": obj.get("RecommendationType") if obj.get("RecommendationType") is not None else None,
                        "Type": obj.get("Type") if obj.get("Type") is not None else 'ResponsiveSearchAdAssetRecommendation',
                        "RecommendationId": obj.get("RecommendationId") if obj.get("RecommendationId") is not None else None,
                        "RecommendationHash": obj.get("RecommendationHash") if obj.get("RecommendationHash") is not None else None,
                        "CurrentClicks": obj.get("CurrentClicks") if obj.get("CurrentClicks") is not None else None,
                        "EstimatedIncreaseInClicks": obj.get("EstimatedIncreaseInClicks") if obj.get("EstimatedIncreaseInClicks") is not None else None,
                        "CurrentCost": obj.get("CurrentCost") if obj.get("CurrentCost") is not None else None,
                        "EstimatedIncreaseInCost": obj.get("EstimatedIncreaseInCost") if obj.get("EstimatedIncreaseInCost") is not None else None,
                        "CurrentImpressions": obj.get("CurrentImpressions") if obj.get("CurrentImpressions") is not None else None,
                        "EstimatedIncreaseInImpressions": obj.get("EstimatedIncreaseInImpressions") if obj.get("EstimatedIncreaseInImpressions") is not None else None,
                        "CurrentConversions": obj.get("CurrentConversions") if obj.get("CurrentConversions") is not None else None,
                        "EstimatedIncreaseInConversions": obj.get("EstimatedIncreaseInConversions") if obj.get("EstimatedIncreaseInConversions") is not None else None,
                        "Dismissed": obj.get("Dismissed") if obj.get("Dismissed") is not None else None
        })
        return _obj
