# 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 import Currency
from openapi_client.models.adinsight.feed import Feed
from openapi_client.models.adinsight.radius_target import RadiusTarget
from openapi_client.models.adinsight.selection_of_age_enum import SelectionOfAgeEnum
from openapi_client.models.adinsight.selection_of_gender_enum import SelectionOfGenderEnum
from openapi_client.models.adinsight.selection_oflong import SelectionOflong
from typing_extensions import Self

class GetAudienceFullEstimationRequest(BaseModel):
    """
    GetAudienceFullEstimationRequest
    """ # noqa: E501
    age: Optional[SelectionOfAgeEnum] = Field(default=None, alias="Age")
    gender: Optional[SelectionOfGenderEnum] = Field(default=None, alias="Gender")
    audience: Optional[SelectionOflong] = Field(default=None, alias="Audience")
    company: Optional[SelectionOflong] = Field(default=None, alias="Company")
    industry: Optional[SelectionOflong] = Field(default=None, alias="Industry")
    job_function: Optional[SelectionOflong] = Field(default=None, alias="JobFunction")
    location: Optional[SelectionOflong] = Field(default=None, alias="Location")
    radius_targets: Optional[List[Optional[RadiusTarget]]] = Field(default=None, alias="RadiusTargets")
    campaign_bidding_strategy: Optional[StrictInt] = Field(default=None, alias="CampaignBiddingStrategy")
    campaign_sub_type: Optional[StrictInt] = Field(default=None, alias="CampaignSubType")
    feed: Optional[Feed] = Field(default=None, alias="Feed")
    daily_budget: Optional[StrictFloat] = Field(default=None, alias="DailyBudget")
    bid: Optional[StrictFloat] = Field(default=None, alias="Bid")
    currency: Optional[Currency] = Field(default=None, alias="Currency")
    __properties: ClassVar[List[str]] = ["Age", "Gender", "Audience", "Company", "Industry", "JobFunction", "Location", "RadiusTargets", "CampaignBiddingStrategy", "CampaignSubType", "Feed", "DailyBudget", "Bid", "Currency"]

    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 age
        if self.age:
            _dict['Age'] = self.age.to_dict()
        # override the default output from pydantic by calling `to_dict()` of gender
        if self.gender:
            _dict['Gender'] = self.gender.to_dict()
        # override the default output from pydantic by calling `to_dict()` of audience
        if self.audience:
            _dict['Audience'] = self.audience.to_dict()
        # override the default output from pydantic by calling `to_dict()` of company
        if self.company:
            _dict['Company'] = self.company.to_dict()
        # override the default output from pydantic by calling `to_dict()` of industry
        if self.industry:
            _dict['Industry'] = self.industry.to_dict()
        # override the default output from pydantic by calling `to_dict()` of job_function
        if self.job_function:
            _dict['JobFunction'] = self.job_function.to_dict()
        # override the default output from pydantic by calling `to_dict()` of location
        if self.location:
            _dict['Location'] = self.location.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in radius_targets (list)
        _items = []
        if self.radius_targets:
            for _item_radius_targets in self.radius_targets:
                if _item_radius_targets:
                    _items.append(_item_radius_targets.to_dict())
            _dict['RadiusTargets'] = _items
        # override the default output from pydantic by calling `to_dict()` of feed
        if self.feed:
            _dict['Feed'] = self.feed.to_dict()
        # set to None if age (nullable) is None
        # and model_fields_set contains the field
        if self.age is None and "age" in self.model_fields_set:
            _dict['Age'] = None

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

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

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

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

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

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

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

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

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

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

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

        # 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 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

        return _dict

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

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

        _obj = cls.model_validate({
            "Age": SelectionOfAgeEnum.from_dict(obj["Age"]) if obj.get("Age") is not None else None,
                        "Gender": SelectionOfGenderEnum.from_dict(obj["Gender"]) if obj.get("Gender") is not None else None,
                        "Audience": SelectionOflong.from_dict(obj["Audience"]) if obj.get("Audience") is not None else None,
                        "Company": SelectionOflong.from_dict(obj["Company"]) if obj.get("Company") is not None else None,
                        "Industry": SelectionOflong.from_dict(obj["Industry"]) if obj.get("Industry") is not None else None,
                        "JobFunction": SelectionOflong.from_dict(obj["JobFunction"]) if obj.get("JobFunction") is not None else None,
                        "Location": SelectionOflong.from_dict(obj["Location"]) if obj.get("Location") is not None else None,
                        "RadiusTargets": [RadiusTarget.from_dict(_item) for _item in obj["RadiusTargets"]] if obj.get("RadiusTargets") is not None else None,
                        "CampaignBiddingStrategy": obj.get("CampaignBiddingStrategy") if obj.get("CampaignBiddingStrategy") is not None else None,
                        "CampaignSubType": obj.get("CampaignSubType") if obj.get("CampaignSubType") is not None else None,
                        "Feed": Feed.from_dict(obj["Feed"]) if obj.get("Feed") is not None else None,
                        "DailyBudget": obj.get("DailyBudget") if obj.get("DailyBudget") is not None else None,
                        "Bid": obj.get("Bid") if obj.get("Bid") is not None else None,
                        "Currency": obj.get("Currency") if obj.get("Currency") is not None else None
        })
        return _obj
