# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ...commons.types.event_field import EventField
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata


class EventMetric_Count(UniversalBaseModel):
    """
    Defines the metric to be calculated for a column or chart.
    Currently only count metric is supported for events.
    """

    type: typing.Literal["count"] = "count"

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class EventMetric_DistinctCount(UniversalBaseModel):
    """
    Defines the metric to be calculated for a column or chart.
    Currently only count metric is supported for events.
    """

    type: typing.Literal["distinctCount"] = "distinctCount"
    target_field: typing_extensions.Annotated[EventField, FieldMetadata(alias="targetField")]

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


EventMetric = typing.Union[EventMetric_Count, EventMetric_DistinctCount]
