# coding: utf-8

"""
    CampaignManagementService

    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
from enum import Flag, auto

class CampaignAdditionalField(Flag):
    NONE = auto()

    ADSCHEDULEUSESEARCHERTIMEZONE = auto()

    MAXCONVERSIONVALUEBIDDINGSCHEME = auto()

    TARGETIMPRESSIONSHAREBIDDINGSCHEME = auto()

    TARGETSETTING = auto()

    BIDSTRATEGYID = auto()

    CPVCPMBIDDINGSCHEME = auto()

    DYNAMICFEEDSETTING = auto()

    MULTIMEDIAADSBIDADJUSTMENT = auto()

    VERIFIEDTRACKINGSETTING = auto()

    DYNAMICDESCRIPTIONSETTING = auto()

    DISCLAIMERSETTING = auto()

    CAMPAIGNCONVERSIONGOAL = auto()

    TARGETCPAINMAXCONVERSION = auto()

    RESPONSIVESEARCHADSSETTING = auto()

    COSTPERSALEBIDDINGSCHEME = auto()

    SHOPPINGSETTINGSHOPPABLEADSENABLED = auto()

    SHOPPINGSETTINGFEEDLABEL = auto()

    CALLTOACTIONSETTING = auto()

    PAGEFEEDINPERFORMANCEMAXSETTINGS = auto()

    DEALIDS = auto()

    AUTOGENERATEDTEXTANDIMAGEOPTOUTINPERFORMANCEMAXSETTINGS = auto()

    COSTPERSALEOPTOUTINPERFORMANCEMAXSETTINGS = auto()

    VANITYPHARMASETTING = auto()

    MANUALCPI = auto()

    ISDEALCAMPAIGN = auto()

    APPSETTING = auto()

    CALLTOACTIONOPTOUT = auto()

    THIRDPARTYMEASUREMENTSETTING = auto()

    MANUALCPC = auto()

    NEWCUSTOMERACQUISITIONGOALSETTING = auto()

    LIFETIMEBUDGETFIELDS = auto()

    MAXCONVERSIONVALUEWITHMAXCPC = auto()

    PMAXAPPCAMPAIGN = auto()

    CROSSACCOUNTBIDSTRATEGYFIELDS = auto()

    AISEARCHSETTING = auto()

	
    def to_json(self) -> str:
        """Convert to JSON string representation"""
        return self._to_str()
	
    def __str__(self) -> str:
        """
        Return a human-readable string representation of the campaign types.
        """
        return self._to_str()

    def _to_str(self) -> str:
        _NAME_MAPPING = {
            CampaignAdditionalField.NONE: 'None',
            CampaignAdditionalField.ADSCHEDULEUSESEARCHERTIMEZONE: 'AdScheduleUseSearcherTimeZone',
            CampaignAdditionalField.MAXCONVERSIONVALUEBIDDINGSCHEME: 'MaxConversionValueBiddingScheme',
            CampaignAdditionalField.TARGETIMPRESSIONSHAREBIDDINGSCHEME: 'TargetImpressionShareBiddingScheme',
            CampaignAdditionalField.TARGETSETTING: 'TargetSetting',
            CampaignAdditionalField.BIDSTRATEGYID: 'BidStrategyId',
            CampaignAdditionalField.CPVCPMBIDDINGSCHEME: 'CpvCpmBiddingScheme',
            CampaignAdditionalField.DYNAMICFEEDSETTING: 'DynamicFeedSetting',
            CampaignAdditionalField.MULTIMEDIAADSBIDADJUSTMENT: 'MultimediaAdsBidAdjustment',
            CampaignAdditionalField.VERIFIEDTRACKINGSETTING: 'VerifiedTrackingSetting',
            CampaignAdditionalField.DYNAMICDESCRIPTIONSETTING: 'DynamicDescriptionSetting',
            CampaignAdditionalField.DISCLAIMERSETTING: 'DisclaimerSetting',
            CampaignAdditionalField.CAMPAIGNCONVERSIONGOAL: 'CampaignConversionGoal',
            CampaignAdditionalField.TARGETCPAINMAXCONVERSION: 'TargetCpaInMaxConversion',
            CampaignAdditionalField.RESPONSIVESEARCHADSSETTING: 'ResponsiveSearchAdsSetting',
            CampaignAdditionalField.COSTPERSALEBIDDINGSCHEME: 'CostPerSaleBiddingScheme',
            CampaignAdditionalField.SHOPPINGSETTINGSHOPPABLEADSENABLED: 'ShoppingSettingShoppableAdsEnabled',
            CampaignAdditionalField.SHOPPINGSETTINGFEEDLABEL: 'ShoppingSettingFeedLabel',
            CampaignAdditionalField.CALLTOACTIONSETTING: 'CallToActionSetting',
            CampaignAdditionalField.PAGEFEEDINPERFORMANCEMAXSETTINGS: 'PageFeedInPerformanceMaxSettings',
            CampaignAdditionalField.DEALIDS: 'DealIds',
            CampaignAdditionalField.AUTOGENERATEDTEXTANDIMAGEOPTOUTINPERFORMANCEMAXSETTINGS: 'AutoGeneratedTextAndImageOptOutInPerformanceMaxSettings',
            CampaignAdditionalField.COSTPERSALEOPTOUTINPERFORMANCEMAXSETTINGS: 'CostPerSaleOptOutInPerformanceMaxSettings',
            CampaignAdditionalField.VANITYPHARMASETTING: 'VanityPharmaSetting',
            CampaignAdditionalField.MANUALCPI: 'ManualCpi',
            CampaignAdditionalField.ISDEALCAMPAIGN: 'IsDealCampaign',
            CampaignAdditionalField.APPSETTING: 'AppSetting',
            CampaignAdditionalField.CALLTOACTIONOPTOUT: 'CallToActionOptOut',
            CampaignAdditionalField.THIRDPARTYMEASUREMENTSETTING: 'ThirdPartyMeasurementSetting',
            CampaignAdditionalField.MANUALCPC: 'ManualCpc',
            CampaignAdditionalField.NEWCUSTOMERACQUISITIONGOALSETTING: 'NewCustomerAcquisitionGoalSetting',
            CampaignAdditionalField.LIFETIMEBUDGETFIELDS: 'LifetimeBudgetFields',
            CampaignAdditionalField.MAXCONVERSIONVALUEWITHMAXCPC: 'MaxConversionValueWithMaxCpc',
            CampaignAdditionalField.PMAXAPPCAMPAIGN: 'PmaxAppCampaign',
            CampaignAdditionalField.CROSSACCOUNTBIDSTRATEGYFIELDS: 'CrossAccountBidStrategyFields',
            CampaignAdditionalField.AISEARCHSETTING: 'AISearchSetting',
        }
        """Convert the enum flags to a comma-separated string of quoted, capitalized names"""
        names = [_NAME_MAPPING[flag] for flag in CampaignAdditionalField if flag & self]
        if not names:
            return "None"
        if len(names) == 1:
            # For single values, use single quotes
            return f"{names[0]}"
        # For multiple values, use double quotes with comma separation
        return ", ".join(f"{name}" for name in names)
		
    @classmethod
    def __get_validators__(cls):
        yield cls._validate
		
    @classmethod
    def _validate(cls, value, handler) -> "CampaignAdditionalField":
        if isinstance(value, cls):
            return value
        if isinstance(value, int):
            return cls(value)
        if isinstance(value, str):
            # Handle comma-separated campaign types
            types = [type_str.strip() for type_str in value.split(',')]
            if len(types) > 1:
                result = cls.NONE
                for type_str in types:
                    try:
                        result |= getattr(cls, type_str.upper())
                    except AttributeError:
                        raise ValueError(f"Invalid CampaignType value: {type_str}")
                return result
            else:
                # Single campaign type
                try:
                    return getattr(cls, value.strip().upper())
                except AttributeError:
                    raise ValueError(f"Invalid CampaignAdditionalField value: {value}")
        raise ValueError(f"Cannot convert {value} to CampaignAdditionalField")


