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

    aggregation_type: typing.Literal["custom"] = "custom"
    custom_expression: 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 PricingMetricAggregation_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 PricingMetricAggregation_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 PricingMetricAggregation_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


PricingMetricAggregation = typing.Union[
    PricingMetricAggregation_Count,
    PricingMetricAggregation_Custom,
    PricingMetricAggregation_Last,
    PricingMetricAggregation_Max,
    PricingMetricAggregation_Sum,
]
