# 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 typing_extensions import Self

class BidOpportunity(BaseModel):
    """
    BidOpportunity
    """ # noqa: E501
    campaign_id: Optional[StrictStr] = Field(default=None, alias="CampaignId")
    ad_group_id: Optional[StrictStr] = Field(default=None, alias="AdGroupId")
    keyword_id: Optional[StrictStr] = Field(default=None, alias="KeywordId")
    current_bid: Optional[StrictFloat] = Field(default=None, alias="CurrentBid")
    match_type: Optional[StrictStr] = Field(default=None, alias="MatchType")
    suggested_bid: Optional[StrictFloat] = Field(default=None, alias="SuggestedBid")
    estimated_increase_in_impressions: Optional[StrictStr] = Field(default=None, alias="EstimatedIncreaseInImpressions")
    estimated_increase_in_clicks: Optional[StrictFloat] = Field(default=None, alias="EstimatedIncreaseInClicks")
    estimated_increase_in_cost: Optional[StrictFloat] = Field(default=None, alias="EstimatedIncreaseInCost")
    opportunity_key: Optional[StrictStr] = Field(default=None, alias="OpportunityKey")
    __properties: ClassVar[List[str]] = ["CampaignId", "AdGroupId", "KeywordId", "CurrentBid", "MatchType", "SuggestedBid", "EstimatedIncreaseInImpressions", "EstimatedIncreaseInClicks", "EstimatedIncreaseInCost", "OpportunityKey"]

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

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

        # set to None if match_type (nullable) is None
        # and model_fields_set contains the field
        if self.match_type is None and "match_type" in self.model_fields_set:
            _dict['MatchType'] = 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 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 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 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 opportunity_key (nullable) is None
        # and model_fields_set contains the field
        if self.opportunity_key is None and "opportunity_key" in self.model_fields_set:
            _dict['OpportunityKey'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "CampaignId": obj.get("CampaignId") if obj.get("CampaignId") is not None else None,
                        "AdGroupId": obj.get("AdGroupId") if obj.get("AdGroupId") is not None else None,
                        "KeywordId": obj.get("KeywordId") if obj.get("KeywordId") is not None else None,
                        "CurrentBid": obj.get("CurrentBid") if obj.get("CurrentBid") is not None else None,
                        "MatchType": obj.get("MatchType") if obj.get("MatchType") is not None else None,
                        "SuggestedBid": obj.get("SuggestedBid") if obj.get("SuggestedBid") is not None else None,
                        "EstimatedIncreaseInImpressions": obj.get("EstimatedIncreaseInImpressions") if obj.get("EstimatedIncreaseInImpressions") is not None else None,
                        "EstimatedIncreaseInClicks": obj.get("EstimatedIncreaseInClicks") if obj.get("EstimatedIncreaseInClicks") is not None else None,
                        "EstimatedIncreaseInCost": obj.get("EstimatedIncreaseInCost") if obj.get("EstimatedIncreaseInCost") is not None else None,
                        "OpportunityKey": obj.get("OpportunityKey") if obj.get("OpportunityKey") is not None else None
        })
        return _obj
