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

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.serialization import FieldMetadata
from .agent_user_analytics_request import AgentUserAnalyticsRequest
from .agent_user_column_definition import AgentUserColumnDefinition
from .time_interval import TimeInterval


class AgentUserTableRequest(AgentUserAnalyticsRequest):
    """
    Examples
    --------
    from mavenagi.analytics import (
        AgentUserColumnDefinition,
        AgentUserMetric_Count,
        AgentUserTableRequest,
    )
    from mavenagi.users import AgentUserFilter

    AgentUserTableRequest(
        agent_user_filter=AgentUserFilter(
            search="john",
        ),
        column_definitions=[
            AgentUserColumnDefinition(
                header="user_count",
                metric=AgentUserMetric_Count(),
            )
        ],
    )
    """

    time_grouping: typing_extensions.Annotated[typing.Optional[TimeInterval], FieldMetadata(alias="timeGrouping")] = (
        pydantic.Field(default=None)
    )
    """
    Defines the time interval for grouping data. If specified, data is grouped accordingly based on the time they were created.
     Example: If set to "DAY," data will be aggregated by day.
    """

    column_definitions: typing_extensions.Annotated[
        typing.List[AgentUserColumnDefinition], FieldMetadata(alias="columnDefinitions")
    ] = pydantic.Field()
    """
    Specifies the metrics to be displayed as columns.
    Only the `count` metric is supported for agent user tables, so each table will have a single column definition using `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
