# coding: utf-8

"""
    ReportingService

    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 json
import pprint
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self

class ReportRequest(BaseModel):
    """
    ReportRequest
    """

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )

    def __init__(self, **kwargs):
        if 'type' not in kwargs and 'Type' not in kwargs:
            class_name = self.__class__.__name__
            type_mapping = [
                ('AccountPerformanceReportRequest', 'AccountPerformanceReportRequest'),
                ('AdDynamicTextPerformanceReportRequest', 'AdDynamicTextPerformanceReportRequest'),
                ('AdExtensionByAdReportRequest', 'AdExtensionByAdReportRequest'),
                ('AdExtensionByKeywordReportRequest', 'AdExtensionByKeywordReportRequest'),
                ('AdExtensionDetailReportRequest', 'AdExtensionDetailReportRequest'),
                ('AdGroupPerformanceReportRequest', 'AdGroupPerformanceReportRequest'),
                ('AdPerformanceReportRequest', 'AdPerformanceReportRequest'),
                ('AgeGenderAudienceReportRequest', 'AgeGenderAudienceReportRequest'),
                ('AppsPerformanceReportRequest', 'AppsPerformanceReportRequest'),
                ('AssetGroupPerformanceReportRequest', 'AssetGroupPerformanceReportRequest'),
                ('AssetPerformanceReportRequest', 'AssetPerformanceReportRequest'),
                ('AudiencePerformanceReportRequest', 'AudiencePerformanceReportRequest'),
                ('BidStrategyReportRequest', 'BidStrategyReportRequest'),
                ('BudgetSummaryReportRequest', 'BudgetSummaryReportRequest'),
                ('CallDetailReportRequest', 'CallDetailReportRequest'),
                ('CampaignPerformanceReportRequest', 'CampaignPerformanceReportRequest'),
                ('CategoryClickCoverageReportRequest', 'CategoryClickCoverageReportRequest'),
                ('CategoryInsightsReportRequest', 'CategoryInsightsReportRequest'),
                ('CombinationPerformanceReportRequest', 'CombinationPerformanceReportRequest'),
                ('ConversionPerformanceReportRequest', 'ConversionPerformanceReportRequest'),
                ('DSAAutoTargetPerformanceReportRequest', 'DSAAutoTargetPerformanceReportRequest'),
                ('DSACategoryPerformanceReportRequest', 'DSACategoryPerformanceReportRequest'),
                ('DSASearchQueryPerformanceReportRequest', 'DSASearchQueryPerformanceReportRequest'),
                ('DestinationUrlPerformanceReportRequest', 'DestinationUrlPerformanceReportRequest'),
                ('FeedItemPerformanceReportRequest', 'FeedItemPerformanceReportRequest'),
                ('GeographicPerformanceReportRequest', 'GeographicPerformanceReportRequest'),
                ('GoalsAndFunnelsReportRequest', 'GoalsAndFunnelsReportRequest'),
                ('HotelDimensionPerformanceReportRequest', 'HotelDimensionPerformanceReportRequest'),
                ('HotelGroupPerformanceReportRequest', 'HotelGroupPerformanceReportRequest'),
                ('KeywordPerformanceReportRequest', 'KeywordPerformanceReportRequest'),
                ('NegativeKeywordConflictReportRequest', 'NegativeKeywordConflictReportRequest'),
                ('ProductDimensionPerformanceReportRequest', 'ProductDimensionPerformanceReportRequest'),
                ('ProductMatchCountReportRequest', 'ProductMatchCountReportRequest'),
                ('ProductNegativeKeywordConflictReportRequest', 'ProductNegativeKeywordConflictReportRequest'),
                ('ProductPartitionPerformanceReportRequest', 'ProductPartitionPerformanceReportRequest'),
                ('ProductPartitionUnitPerformanceReportRequest', 'ProductPartitionUnitPerformanceReportRequest'),
                ('ProductSearchQueryPerformanceReportRequest', 'ProductSearchQueryPerformanceReportRequest'),
                ('ProfessionalDemographicsAudienceReportRequest', 'ProfessionalDemographicsAudienceReportRequest'),
                ('PublisherUsagePerformanceReportRequest', 'PublisherUsagePerformanceReportRequest'),
                ('SearchCampaignChangeHistoryReportRequest', 'SearchCampaignChangeHistoryReportRequest'),
                ('SearchInsightPerformanceReportRequest', 'SearchInsightPerformanceReportRequest'),
                ('SearchQueryPerformanceReportRequest', 'SearchQueryPerformanceReportRequest'),
                ('ShareOfVoiceReportRequest', 'ShareOfVoiceReportRequest'),
                ('TravelQueryInsightReportRequest', 'TravelQueryInsightReportRequest'),
                ('UserLocationPerformanceReportRequest', 'UserLocationPerformanceReportRequest'),
            ]
            for key, value in type_mapping:
                if class_name == key:
                    kwargs['type'] = value
                    break
        super().__init__(**kwargs)

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: Optional[str]) -> Self:
        """Create an instance of ReportRequest from a JSON string"""
        return cls.from_dict(json.loads(json_str))
    
    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias."""
        excluded_fields: Set[str] = set([])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        
        # set to None if type (nullable) is None and model_fields_set contains the field
        if self.type is None and "type" in self.model_fields_set:
            _dict['Type'] = None

        return _dict

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

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

        # Try to determine the specific media type from the Type field
        type = obj.get("Type")
        
        # Import here to avoid circular imports
        if type == "AccountPerformanceReportRequest":
            from openapi_client.models.reporting.account_performance_report_request import AccountPerformanceReportRequest
            return AccountPerformanceReportRequest.from_dict(obj)
        
        if type == "AdDynamicTextPerformanceReportRequest":
            from openapi_client.models.reporting.ad_dynamic_text_performance_report_request import AdDynamicTextPerformanceReportRequest
            return AdDynamicTextPerformanceReportRequest.from_dict(obj)
        
        if type == "AdExtensionByAdReportRequest":
            from openapi_client.models.reporting.ad_extension_by_ad_report_request import AdExtensionByAdReportRequest
            return AdExtensionByAdReportRequest.from_dict(obj)
        
        if type == "AdExtensionByKeywordReportRequest":
            from openapi_client.models.reporting.ad_extension_by_keyword_report_request import AdExtensionByKeywordReportRequest
            return AdExtensionByKeywordReportRequest.from_dict(obj)
        
        if type == "AdExtensionDetailReportRequest":
            from openapi_client.models.reporting.ad_extension_detail_report_request import AdExtensionDetailReportRequest
            return AdExtensionDetailReportRequest.from_dict(obj)
        
        if type == "AdGroupPerformanceReportRequest":
            from openapi_client.models.reporting.ad_group_performance_report_request import AdGroupPerformanceReportRequest
            return AdGroupPerformanceReportRequest.from_dict(obj)
        
        if type == "AdPerformanceReportRequest":
            from openapi_client.models.reporting.ad_performance_report_request import AdPerformanceReportRequest
            return AdPerformanceReportRequest.from_dict(obj)
        
        if type == "AgeGenderAudienceReportRequest":
            from openapi_client.models.reporting.age_gender_audience_report_request import AgeGenderAudienceReportRequest
            return AgeGenderAudienceReportRequest.from_dict(obj)
        
        if type == "AppsPerformanceReportRequest":
            from openapi_client.models.reporting.apps_performance_report_request import AppsPerformanceReportRequest
            return AppsPerformanceReportRequest.from_dict(obj)
        
        if type == "AssetGroupPerformanceReportRequest":
            from openapi_client.models.reporting.asset_group_performance_report_request import AssetGroupPerformanceReportRequest
            return AssetGroupPerformanceReportRequest.from_dict(obj)
        
        if type == "AssetPerformanceReportRequest":
            from openapi_client.models.reporting.asset_performance_report_request import AssetPerformanceReportRequest
            return AssetPerformanceReportRequest.from_dict(obj)
        
        if type == "AudiencePerformanceReportRequest":
            from openapi_client.models.reporting.audience_performance_report_request import AudiencePerformanceReportRequest
            return AudiencePerformanceReportRequest.from_dict(obj)
        
        if type == "BidStrategyReportRequest":
            from openapi_client.models.reporting.bid_strategy_report_request import BidStrategyReportRequest
            return BidStrategyReportRequest.from_dict(obj)
        
        if type == "BudgetSummaryReportRequest":
            from openapi_client.models.reporting.budget_summary_report_request import BudgetSummaryReportRequest
            return BudgetSummaryReportRequest.from_dict(obj)
        
        if type == "CallDetailReportRequest":
            from openapi_client.models.reporting.call_detail_report_request import CallDetailReportRequest
            return CallDetailReportRequest.from_dict(obj)
        
        if type == "CampaignPerformanceReportRequest":
            from openapi_client.models.reporting.campaign_performance_report_request import CampaignPerformanceReportRequest
            return CampaignPerformanceReportRequest.from_dict(obj)
        
        if type == "CategoryClickCoverageReportRequest":
            from openapi_client.models.reporting.category_click_coverage_report_request import CategoryClickCoverageReportRequest
            return CategoryClickCoverageReportRequest.from_dict(obj)
        
        if type == "CategoryInsightsReportRequest":
            from openapi_client.models.reporting.category_insights_report_request import CategoryInsightsReportRequest
            return CategoryInsightsReportRequest.from_dict(obj)
        
        if type == "CombinationPerformanceReportRequest":
            from openapi_client.models.reporting.combination_performance_report_request import CombinationPerformanceReportRequest
            return CombinationPerformanceReportRequest.from_dict(obj)
        
        if type == "ConversionPerformanceReportRequest":
            from openapi_client.models.reporting.conversion_performance_report_request import ConversionPerformanceReportRequest
            return ConversionPerformanceReportRequest.from_dict(obj)
        
        if type == "DSAAutoTargetPerformanceReportRequest":
            from openapi_client.models.reporting.dsa_auto_target_performance_report_request import DSAAutoTargetPerformanceReportRequest
            return DSAAutoTargetPerformanceReportRequest.from_dict(obj)
        
        if type == "DSACategoryPerformanceReportRequest":
            from openapi_client.models.reporting.dsa_category_performance_report_request import DSACategoryPerformanceReportRequest
            return DSACategoryPerformanceReportRequest.from_dict(obj)
        
        if type == "DSASearchQueryPerformanceReportRequest":
            from openapi_client.models.reporting.dsa_search_query_performance_report_request import DSASearchQueryPerformanceReportRequest
            return DSASearchQueryPerformanceReportRequest.from_dict(obj)
        
        if type == "DestinationUrlPerformanceReportRequest":
            from openapi_client.models.reporting.destination_url_performance_report_request import DestinationUrlPerformanceReportRequest
            return DestinationUrlPerformanceReportRequest.from_dict(obj)
        
        if type == "FeedItemPerformanceReportRequest":
            from openapi_client.models.reporting.feed_item_performance_report_request import FeedItemPerformanceReportRequest
            return FeedItemPerformanceReportRequest.from_dict(obj)
        
        if type == "GeographicPerformanceReportRequest":
            from openapi_client.models.reporting.geographic_performance_report_request import GeographicPerformanceReportRequest
            return GeographicPerformanceReportRequest.from_dict(obj)
        
        if type == "GoalsAndFunnelsReportRequest":
            from openapi_client.models.reporting.goals_and_funnels_report_request import GoalsAndFunnelsReportRequest
            return GoalsAndFunnelsReportRequest.from_dict(obj)
        
        if type == "HotelDimensionPerformanceReportRequest":
            from openapi_client.models.reporting.hotel_dimension_performance_report_request import HotelDimensionPerformanceReportRequest
            return HotelDimensionPerformanceReportRequest.from_dict(obj)
        
        if type == "HotelGroupPerformanceReportRequest":
            from openapi_client.models.reporting.hotel_group_performance_report_request import HotelGroupPerformanceReportRequest
            return HotelGroupPerformanceReportRequest.from_dict(obj)
        
        if type == "KeywordPerformanceReportRequest":
            from openapi_client.models.reporting.keyword_performance_report_request import KeywordPerformanceReportRequest
            return KeywordPerformanceReportRequest.from_dict(obj)
        
        if type == "NegativeKeywordConflictReportRequest":
            from openapi_client.models.reporting.negative_keyword_conflict_report_request import NegativeKeywordConflictReportRequest
            return NegativeKeywordConflictReportRequest.from_dict(obj)
        
        if type == "ProductDimensionPerformanceReportRequest":
            from openapi_client.models.reporting.product_dimension_performance_report_request import ProductDimensionPerformanceReportRequest
            return ProductDimensionPerformanceReportRequest.from_dict(obj)
        
        if type == "ProductMatchCountReportRequest":
            from openapi_client.models.reporting.product_match_count_report_request import ProductMatchCountReportRequest
            return ProductMatchCountReportRequest.from_dict(obj)
        
        if type == "ProductNegativeKeywordConflictReportRequest":
            from openapi_client.models.reporting.product_negative_keyword_conflict_report_request import ProductNegativeKeywordConflictReportRequest
            return ProductNegativeKeywordConflictReportRequest.from_dict(obj)
        
        if type == "ProductPartitionPerformanceReportRequest":
            from openapi_client.models.reporting.product_partition_performance_report_request import ProductPartitionPerformanceReportRequest
            return ProductPartitionPerformanceReportRequest.from_dict(obj)
        
        if type == "ProductPartitionUnitPerformanceReportRequest":
            from openapi_client.models.reporting.product_partition_unit_performance_report_request import ProductPartitionUnitPerformanceReportRequest
            return ProductPartitionUnitPerformanceReportRequest.from_dict(obj)
        
        if type == "ProductSearchQueryPerformanceReportRequest":
            from openapi_client.models.reporting.product_search_query_performance_report_request import ProductSearchQueryPerformanceReportRequest
            return ProductSearchQueryPerformanceReportRequest.from_dict(obj)
        
        if type == "ProfessionalDemographicsAudienceReportRequest":
            from openapi_client.models.reporting.professional_demographics_audience_report_request import ProfessionalDemographicsAudienceReportRequest
            return ProfessionalDemographicsAudienceReportRequest.from_dict(obj)
        
        if type == "PublisherUsagePerformanceReportRequest":
            from openapi_client.models.reporting.publisher_usage_performance_report_request import PublisherUsagePerformanceReportRequest
            return PublisherUsagePerformanceReportRequest.from_dict(obj)
        
        if type == "SearchCampaignChangeHistoryReportRequest":
            from openapi_client.models.reporting.search_campaign_change_history_report_request import SearchCampaignChangeHistoryReportRequest
            return SearchCampaignChangeHistoryReportRequest.from_dict(obj)
        
        if type == "SearchInsightPerformanceReportRequest":
            from openapi_client.models.reporting.search_insight_performance_report_request import SearchInsightPerformanceReportRequest
            return SearchInsightPerformanceReportRequest.from_dict(obj)
        
        if type == "SearchQueryPerformanceReportRequest":
            from openapi_client.models.reporting.search_query_performance_report_request import SearchQueryPerformanceReportRequest
            return SearchQueryPerformanceReportRequest.from_dict(obj)
        
        if type == "ShareOfVoiceReportRequest":
            from openapi_client.models.reporting.share_of_voice_report_request import ShareOfVoiceReportRequest
            return ShareOfVoiceReportRequest.from_dict(obj)
        
        if type == "TravelQueryInsightReportRequest":
            from openapi_client.models.reporting.travel_query_insight_report_request import TravelQueryInsightReportRequest
            return TravelQueryInsightReportRequest.from_dict(obj)
        
        if type == "UserLocationPerformanceReportRequest":
            from openapi_client.models.reporting.user_location_performance_report_request import UserLocationPerformanceReportRequest
            return UserLocationPerformanceReportRequest.from_dict(obj)
        
        
        # Fallback to base class
        _obj = cls.model_validate({
            "Type": obj.get("Type") if obj.get("Type") is not None else None
        })
        return _obj
