# 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.breakdowns import Breakdowns
from openapi_client.models.adinsight.currency import Currency
from openapi_client.models.adinsight.decimal_rounded_result import DecimalRoundedResult
from typing_extensions import Self

class GetAudienceBreakdownResponse(BaseModel):
    """
    GetAudienceBreakdownResponse
    """ # noqa: E501
    est_audience_size: Optional[DecimalRoundedResult] = Field(default=None, alias="EstAudienceSize")
    est_impression: Optional[DecimalRoundedResult] = Field(default=None, alias="EstImpression")
    is_impression_too_specific: Optional[StrictBool] = Field(default=None, alias="IsImpressionTooSpecific")
    is_privacy_check_passed: Optional[StrictBool] = Field(default=None, alias="IsPrivacyCheckPassed")
    suggested_bid: Optional[StrictFloat] = Field(default=None, alias="SuggestedBid")
    currency: Optional[Currency] = Field(default=None, alias="Currency")
    breakdowns: Optional[Breakdowns] = Field(default=None, alias="Breakdowns")
    __properties: ClassVar[List[str]] = ["EstAudienceSize", "EstImpression", "IsImpressionTooSpecific", "IsPrivacyCheckPassed", "SuggestedBid", "Currency", "Breakdowns"]

    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,
        )
        # override the default output from pydantic by calling `to_dict()` of est_audience_size
        if self.est_audience_size:
            _dict['EstAudienceSize'] = self.est_audience_size.to_dict()
        # override the default output from pydantic by calling `to_dict()` of est_impression
        if self.est_impression:
            _dict['EstImpression'] = self.est_impression.to_dict()
        # override the default output from pydantic by calling `to_dict()` of breakdowns
        if self.breakdowns:
            _dict['Breakdowns'] = self.breakdowns.to_dict()
        # set to None if est_audience_size (nullable) is None
        # and model_fields_set contains the field
        if self.est_audience_size is None and "est_audience_size" in self.model_fields_set:
            _dict['EstAudienceSize'] = None

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "EstAudienceSize": DecimalRoundedResult.from_dict(obj["EstAudienceSize"]) if obj.get("EstAudienceSize") is not None else None,
                        "EstImpression": DecimalRoundedResult.from_dict(obj["EstImpression"]) if obj.get("EstImpression") is not None else None,
                        "IsImpressionTooSpecific": obj.get("IsImpressionTooSpecific") if obj.get("IsImpressionTooSpecific") is not None else None,
                        "IsPrivacyCheckPassed": obj.get("IsPrivacyCheckPassed") if obj.get("IsPrivacyCheckPassed") is not None else None,
                        "SuggestedBid": obj.get("SuggestedBid") if obj.get("SuggestedBid") is not None else None,
                        "Currency": obj.get("Currency") if obj.get("Currency") is not None else None,
                        "Breakdowns": Breakdowns.from_dict(obj["Breakdowns"]) if obj.get("Breakdowns") is not None else None
        })
        return _obj
