"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .benefitcustom import BenefitCustom, BenefitCustomTypedDict
from .benefitdiscord import BenefitDiscord, BenefitDiscordTypedDict
from .benefitdownloadables import BenefitDownloadables, BenefitDownloadablesTypedDict
from .benefitfeatureflag import BenefitFeatureFlag, BenefitFeatureFlagTypedDict
from .benefitgithubrepository import (
    BenefitGitHubRepository,
    BenefitGitHubRepositoryTypedDict,
)
from .benefitlicensekeys import BenefitLicenseKeys, BenefitLicenseKeysTypedDict
from .benefitmetercredit import BenefitMeterCredit, BenefitMeterCreditTypedDict
from polar_sdk.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


BenefitTypedDict = TypeAliasType(
    "BenefitTypedDict",
    Union[
        BenefitCustomTypedDict,
        BenefitDiscordTypedDict,
        BenefitGitHubRepositoryTypedDict,
        BenefitDownloadablesTypedDict,
        BenefitLicenseKeysTypedDict,
        BenefitMeterCreditTypedDict,
        BenefitFeatureFlagTypedDict,
    ],
)


Benefit = Annotated[
    Union[
        Annotated[BenefitCustom, Tag("custom")],
        Annotated[BenefitDiscord, Tag("discord")],
        Annotated[BenefitDownloadables, Tag("downloadables")],
        Annotated[BenefitFeatureFlag, Tag("feature_flag")],
        Annotated[BenefitGitHubRepository, Tag("github_repository")],
        Annotated[BenefitLicenseKeys, Tag("license_keys")],
        Annotated[BenefitMeterCredit, Tag("meter_credit")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
