# 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.competition_level import CompetitionLevel
from openapi_client.models.adinsight.source_type import SourceType
from typing_extensions import Self

class KeywordIdea(BaseModel):
    """
    KeywordIdea
    """ # noqa: E501
    keyword: Optional[StrictStr] = Field(default=None, alias="Keyword")
    ad_group_id: Optional[StrictStr] = Field(default=None, alias="AdGroupId")
    ad_group_name: Optional[StrictStr] = Field(default=None, alias="AdGroupName")
    source: Optional[SourceType] = Field(default=None, alias="Source")
    monthly_search_counts: Optional[List[StrictStr]] = Field(default=None, alias="MonthlySearchCounts")
    suggested_bid: Optional[StrictFloat] = Field(default=None, alias="SuggestedBid")
    competition: Optional[CompetitionLevel] = Field(default=None, alias="Competition")
    relevance: Optional[StrictFloat] = Field(default=None, alias="Relevance")
    ad_impression_share: Optional[StrictFloat] = Field(default=None, alias="AdImpressionShare")
    __properties: ClassVar[List[str]] = ["Keyword", "AdGroupId", "AdGroupName", "Source", "MonthlySearchCounts", "SuggestedBid", "Competition", "Relevance", "AdImpressionShare"]

    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,
        )
        # set to None if keyword (nullable) is None
        # and model_fields_set contains the field
        if self.keyword is None and "keyword" in self.model_fields_set:
            _dict['Keyword'] = 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 source (nullable) is None
        # and model_fields_set contains the field
        if self.source is None and "source" in self.model_fields_set:
            _dict['Source'] = None

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Keyword": obj.get("Keyword") if obj.get("Keyword") 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,
                        "Source": obj.get("Source") if obj.get("Source") is not None else None,
                        "MonthlySearchCounts": obj.get("MonthlySearchCounts"),
                        "SuggestedBid": obj.get("SuggestedBid") if obj.get("SuggestedBid") is not None else None,
                        "Competition": obj.get("Competition") if obj.get("Competition") is not None else None,
                        "Relevance": obj.get("Relevance") if obj.get("Relevance") is not None else None,
                        "AdImpressionShare": obj.get("AdImpressionShare") if obj.get("AdImpressionShare") is not None else None
        })
        return _obj
