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

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class Aggregation_Count(UniversalBaseModel):
    """
    The aggregation function used to compute the value of the pricing metric.
    """

    aggregation_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 Aggregation_Last(UniversalBaseModel):
    """
    The aggregation function used to compute the value of the pricing metric.
    """

    aggregation_type: typing.Literal["last"] = "last"
    value_field: str

    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 Aggregation_Max(UniversalBaseModel):
    """
    The aggregation function used to compute the value of the pricing metric.
    """

    aggregation_type: typing.Literal["max"] = "max"
    value_field: str

    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 Aggregation_Sum(UniversalBaseModel):
    """
    The aggregation function used to compute the value of the pricing metric.
    """

    aggregation_type: typing.Literal["sum"] = "sum"
    value_field: str

    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


Aggregation = typing.Union[Aggregation_Count, Aggregation_Last, Aggregation_Max, Aggregation_Sum]
