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

from __future__ import annotations
from .benefitcycledevent import BenefitCycledEvent, BenefitCycledEventTypedDict
from .benefitgrantedevent import BenefitGrantedEvent, BenefitGrantedEventTypedDict
from .benefitrevokedevent import BenefitRevokedEvent, BenefitRevokedEventTypedDict
from .benefitupdatedevent import BenefitUpdatedEvent, BenefitUpdatedEventTypedDict
from .metercreditevent import MeterCreditEvent, MeterCreditEventTypedDict
from .meterresetevent import MeterResetEvent, MeterResetEventTypedDict
from polar_sdk.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


SystemEventTypedDict = TypeAliasType(
    "SystemEventTypedDict",
    Union[
        MeterCreditEventTypedDict,
        MeterResetEventTypedDict,
        BenefitGrantedEventTypedDict,
        BenefitCycledEventTypedDict,
        BenefitUpdatedEventTypedDict,
        BenefitRevokedEventTypedDict,
    ],
)


SystemEvent = Annotated[
    Union[
        Annotated[BenefitCycledEvent, Tag("benefit.cycled")],
        Annotated[BenefitGrantedEvent, Tag("benefit.granted")],
        Annotated[BenefitRevokedEvent, Tag("benefit.revoked")],
        Annotated[BenefitUpdatedEvent, Tag("benefit.updated")],
        Annotated[MeterCreditEvent, Tag("meter.credited")],
        Annotated[MeterResetEvent, Tag("meter.reset")],
    ],
    Discriminator(lambda m: get_discriminator(m, "name", "name")),
]
