# 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.currency_code import CurrencyCode
from openapi_client.models.adinsight.match_type import MatchType
from typing_extensions import Self

class EstimatedBidAndTraffic(BaseModel):
    """
    EstimatedBidAndTraffic
    """ # noqa: E501
    min_clicks_per_week: Optional[StrictFloat] = Field(default=None, alias="MinClicksPerWeek")
    max_clicks_per_week: Optional[StrictFloat] = Field(default=None, alias="MaxClicksPerWeek")
    average_cpc: Optional[StrictFloat] = Field(default=None, alias="AverageCPC")
    min_impressions_per_week: Optional[StrictStr] = Field(default=None, alias="MinImpressionsPerWeek")
    max_impressions_per_week: Optional[StrictStr] = Field(default=None, alias="MaxImpressionsPerWeek")
    ctr: Optional[StrictFloat] = Field(default=None, alias="CTR")
    min_total_cost_per_week: Optional[StrictFloat] = Field(default=None, alias="MinTotalCostPerWeek")
    max_total_cost_per_week: Optional[StrictFloat] = Field(default=None, alias="MaxTotalCostPerWeek")
    currency_code: Optional[CurrencyCode] = Field(default=None, alias="CurrencyCode")
    match_type: Optional[MatchType] = Field(default=None, alias="MatchType")
    estimated_min_bid: Optional[StrictFloat] = Field(default=None, alias="EstimatedMinBid")
    __properties: ClassVar[List[str]] = ["MinClicksPerWeek", "MaxClicksPerWeek", "AverageCPC", "MinImpressionsPerWeek", "MaxImpressionsPerWeek", "CTR", "MinTotalCostPerWeek", "MaxTotalCostPerWeek", "CurrencyCode", "MatchType", "EstimatedMinBid"]

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "MinClicksPerWeek": obj.get("MinClicksPerWeek") if obj.get("MinClicksPerWeek") is not None else None,
                        "MaxClicksPerWeek": obj.get("MaxClicksPerWeek") if obj.get("MaxClicksPerWeek") is not None else None,
                        "AverageCPC": obj.get("AverageCPC") if obj.get("AverageCPC") is not None else None,
                        "MinImpressionsPerWeek": obj.get("MinImpressionsPerWeek") if obj.get("MinImpressionsPerWeek") is not None else None,
                        "MaxImpressionsPerWeek": obj.get("MaxImpressionsPerWeek") if obj.get("MaxImpressionsPerWeek") is not None else None,
                        "CTR": obj.get("CTR") if obj.get("CTR") is not None else None,
                        "MinTotalCostPerWeek": obj.get("MinTotalCostPerWeek") if obj.get("MinTotalCostPerWeek") is not None else None,
                        "MaxTotalCostPerWeek": obj.get("MaxTotalCostPerWeek") if obj.get("MaxTotalCostPerWeek") is not None else None,
                        "CurrencyCode": obj.get("CurrencyCode") if obj.get("CurrencyCode") is not None else None,
                        "MatchType": obj.get("MatchType") if obj.get("MatchType") is not None else None,
                        "EstimatedMinBid": obj.get("EstimatedMinBid") if obj.get("EstimatedMinBid") is not None else None
        })
        return _obj
