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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel


class EntityQueryRequest(UncheckedBaseModel):
    """
    Query for entities (agents or objects)
    """

    entity_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    'agent' or 'object'
    """

    activity_filters: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Filter activities that entities appear in
    """

    tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Activities must have these tags
    """

    outcomes: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Activities must have these outcomes
    """

    actions: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Activities must have these actions
    """

    time: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Time range for activities
    """

    kinds: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Entity kinds to include (user, team, document, etc)
    """

    roles: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Entity roles to include
    """

    current_state: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Return only current state via quantum collapse
    """

    include_stats: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Include activity statistics for each entity
    """

    group_by: typing.Optional[str] = pydantic.Field(default=None)
    """
    Group entities by field (kind, role)
    """

    limit: typing.Optional[int] = None
    min_activities: typing.Optional[int] = pydantic.Field(default=None)
    """
    Minimum activities for entity to be included
    """

    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
