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

class BidLandscapePoint(BaseModel):
    """
    BidLandscapePoint
    """ # noqa: E501
    bid: Optional[StrictFloat] = Field(default=None, alias="Bid")
    clicks: Optional[StrictFloat] = Field(default=None, alias="Clicks")
    impressions: Optional[StrictStr] = Field(default=None, alias="Impressions")
    top_impressions: Optional[StrictStr] = Field(default=None, alias="TopImpressions")
    currency_code: Optional[CurrencyCode] = Field(default=None, alias="CurrencyCode")
    cost: Optional[StrictFloat] = Field(default=None, alias="Cost")
    marginal_cpc: Optional[StrictFloat] = Field(default=None, alias="MarginalCPC")
    __properties: ClassVar[List[str]] = ["Bid", "Clicks", "Impressions", "TopImpressions", "CurrencyCode", "Cost", "MarginalCPC"]

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Bid": obj.get("Bid") if obj.get("Bid") is not None else None,
                        "Clicks": obj.get("Clicks") if obj.get("Clicks") is not None else None,
                        "Impressions": obj.get("Impressions") if obj.get("Impressions") is not None else None,
                        "TopImpressions": obj.get("TopImpressions") if obj.get("TopImpressions") is not None else None,
                        "CurrencyCode": obj.get("CurrencyCode") if obj.get("CurrencyCode") is not None else None,
                        "Cost": obj.get("Cost") if obj.get("Cost") is not None else None,
                        "MarginalCPC": obj.get("MarginalCPC") if obj.get("MarginalCPC") is not None else None
        })
        return _obj
