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

from __future__ import annotations
from .customfieldcheckbox import CustomFieldCheckbox, CustomFieldCheckboxTypedDict
from .customfielddate import CustomFieldDate, CustomFieldDateTypedDict
from .customfieldnumber import CustomFieldNumber, CustomFieldNumberTypedDict
from .customfieldselect import CustomFieldSelect, CustomFieldSelectTypedDict
from .customfieldtext import CustomFieldText, CustomFieldTextTypedDict
from polar_sdk.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType


CustomFieldTypedDict = TypeAliasType(
    "CustomFieldTypedDict",
    Union[
        CustomFieldTextTypedDict,
        CustomFieldNumberTypedDict,
        CustomFieldDateTypedDict,
        CustomFieldCheckboxTypedDict,
        CustomFieldSelectTypedDict,
    ],
)


CustomField = Annotated[
    Union[
        Annotated[CustomFieldCheckbox, Tag("checkbox")],
        Annotated[CustomFieldDate, Tag("date")],
        Annotated[CustomFieldNumber, Tag("number")],
        Annotated[CustomFieldSelect, Tag("select")],
        Annotated[CustomFieldText, Tag("text")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
