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

from __future__ import annotations
from .balancedisputeevent import BalanceDisputeEvent, BalanceDisputeEventTypedDict
from .balancedisputereversalevent import (
    BalanceDisputeReversalEvent,
    BalanceDisputeReversalEventTypedDict,
)
from .balanceorderevent import BalanceOrderEvent, BalanceOrderEventTypedDict
from .balancerefundevent import BalanceRefundEvent, BalanceRefundEventTypedDict
from .balancerefundreversalevent import (
    BalanceRefundReversalEvent,
    BalanceRefundReversalEventTypedDict,
)
from .benefitcycledevent import BenefitCycledEvent, BenefitCycledEventTypedDict
from .benefitgrantedevent import BenefitGrantedEvent, BenefitGrantedEventTypedDict
from .benefitrevokedevent import BenefitRevokedEvent, BenefitRevokedEventTypedDict
from .benefitupdatedevent import BenefitUpdatedEvent, BenefitUpdatedEventTypedDict
from .checkoutcreatedevent import CheckoutCreatedEvent, CheckoutCreatedEventTypedDict
from .customercreatedevent import CustomerCreatedEvent, CustomerCreatedEventTypedDict
from .customerdeletedevent import CustomerDeletedEvent, CustomerDeletedEventTypedDict
from .customerupdatedevent import CustomerUpdatedEvent, CustomerUpdatedEventTypedDict
from .metercreditevent import MeterCreditEvent, MeterCreditEventTypedDict
from .meterresetevent import MeterResetEvent, MeterResetEventTypedDict
from .orderpaidevent import OrderPaidEvent, OrderPaidEventTypedDict
from .orderrefundedevent import OrderRefundedEvent, OrderRefundedEventTypedDict
from .subscriptionbillingperiodupdatedevent import (
    SubscriptionBillingPeriodUpdatedEvent,
    SubscriptionBillingPeriodUpdatedEventTypedDict,
)
from .subscriptioncanceledevent import (
    SubscriptionCanceledEvent,
    SubscriptionCanceledEventTypedDict,
)
from .subscriptioncreatedevent import (
    SubscriptionCreatedEvent,
    SubscriptionCreatedEventTypedDict,
)
from .subscriptioncycledevent import (
    SubscriptionCycledEvent,
    SubscriptionCycledEventTypedDict,
)
from .subscriptionproductupdatedevent import (
    SubscriptionProductUpdatedEvent,
    SubscriptionProductUpdatedEventTypedDict,
)
from .subscriptionrevokedevent import (
    SubscriptionRevokedEvent,
    SubscriptionRevokedEventTypedDict,
)
from .subscriptionseatsupdatedevent import (
    SubscriptionSeatsUpdatedEvent,
    SubscriptionSeatsUpdatedEventTypedDict,
)
from .subscriptionuncanceledevent import (
    SubscriptionUncanceledEvent,
    SubscriptionUncanceledEventTypedDict,
)
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,
        SubscriptionCreatedEventTypedDict,
        SubscriptionCycledEventTypedDict,
        SubscriptionCanceledEventTypedDict,
        SubscriptionRevokedEventTypedDict,
        SubscriptionUncanceledEventTypedDict,
        SubscriptionProductUpdatedEventTypedDict,
        SubscriptionSeatsUpdatedEventTypedDict,
        SubscriptionBillingPeriodUpdatedEventTypedDict,
        OrderPaidEventTypedDict,
        OrderRefundedEventTypedDict,
        CheckoutCreatedEventTypedDict,
        CustomerCreatedEventTypedDict,
        CustomerUpdatedEventTypedDict,
        CustomerDeletedEventTypedDict,
        BalanceOrderEventTypedDict,
        BalanceRefundEventTypedDict,
        BalanceRefundReversalEventTypedDict,
        BalanceDisputeEventTypedDict,
        BalanceDisputeReversalEventTypedDict,
    ],
)


SystemEvent = Annotated[
    Union[
        Annotated[BalanceDisputeEvent, Tag("balance.dispute")],
        Annotated[BalanceDisputeReversalEvent, Tag("balance.dispute_reversal")],
        Annotated[BalanceOrderEvent, Tag("balance.order")],
        Annotated[BalanceRefundEvent, Tag("balance.refund")],
        Annotated[BalanceRefundReversalEvent, Tag("balance.refund_reversal")],
        Annotated[BenefitCycledEvent, Tag("benefit.cycled")],
        Annotated[BenefitGrantedEvent, Tag("benefit.granted")],
        Annotated[BenefitRevokedEvent, Tag("benefit.revoked")],
        Annotated[BenefitUpdatedEvent, Tag("benefit.updated")],
        Annotated[CheckoutCreatedEvent, Tag("checkout.created")],
        Annotated[CustomerCreatedEvent, Tag("customer.created")],
        Annotated[CustomerDeletedEvent, Tag("customer.deleted")],
        Annotated[CustomerUpdatedEvent, Tag("customer.updated")],
        Annotated[MeterCreditEvent, Tag("meter.credited")],
        Annotated[MeterResetEvent, Tag("meter.reset")],
        Annotated[OrderPaidEvent, Tag("order.paid")],
        Annotated[OrderRefundedEvent, Tag("order.refunded")],
        Annotated[
            SubscriptionBillingPeriodUpdatedEvent,
            Tag("subscription.billing_period_updated"),
        ],
        Annotated[SubscriptionCanceledEvent, Tag("subscription.canceled")],
        Annotated[SubscriptionCreatedEvent, Tag("subscription.created")],
        Annotated[SubscriptionCycledEvent, Tag("subscription.cycled")],
        Annotated[SubscriptionProductUpdatedEvent, Tag("subscription.product_updated")],
        Annotated[SubscriptionRevokedEvent, Tag("subscription.revoked")],
        Annotated[SubscriptionSeatsUpdatedEvent, Tag("subscription.seats_updated")],
        Annotated[SubscriptionUncanceledEvent, Tag("subscription.uncanceled")],
    ],
    Discriminator(lambda m: get_discriminator(m, "name", "name")),
]
