# 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.keyword import Keyword
from openapi_client.models.adinsight.traffic_estimate import TrafficEstimate
from typing_extensions import Self

class KeywordEstimate(BaseModel):
    """
    KeywordEstimate
    """ # noqa: E501
    keyword: Optional[Keyword] = Field(default=None, alias="Keyword")
    minimum: Optional[TrafficEstimate] = Field(default=None, alias="Minimum")
    maximum: Optional[TrafficEstimate] = Field(default=None, alias="Maximum")
    __properties: ClassVar[List[str]] = ["Keyword", "Minimum", "Maximum"]

    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 keyword
        if self.keyword:
            _dict['Keyword'] = self.keyword.to_dict()
        # override the default output from pydantic by calling `to_dict()` of minimum
        if self.minimum:
            _dict['Minimum'] = self.minimum.to_dict()
        # override the default output from pydantic by calling `to_dict()` of maximum
        if self.maximum:
            _dict['Maximum'] = self.maximum.to_dict()
        # set to None if keyword (nullable) is None
        # and model_fields_set contains the field
        if self.keyword is None and "keyword" in self.model_fields_set:
            _dict['Keyword'] = None

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Keyword": Keyword.from_dict(obj["Keyword"]) if obj.get("Keyword") is not None else None,
                        "Minimum": TrafficEstimate.from_dict(obj["Minimum"]) if obj.get("Minimum") is not None else None,
                        "Maximum": TrafficEstimate.from_dict(obj["Maximum"]) if obj.get("Maximum") is not None else None
        })
        return _obj
