# Generated by ariadne-codegen
# Source: https://app.saola.sg/v1/graphql

from typing import Any, List, Optional

from pydantic import Field

from .base_model import BaseModel
from .enums import (
    agents_select_column,
    authRefreshTokenTypes_enum,
    chat_statuses_enum,
    connections_constraint,
    connections_select_column,
    connections_select_column_connections_aggregate_bool_exp_bool_and_arguments_columns,
    connections_select_column_connections_aggregate_bool_exp_bool_or_arguments_columns,
    connections_update_column,
    crm_record_types_enum,
    cursor_ordering,
    environments_enum,
    handler_names_enum,
    handlers_select_column,
    integration_types_enum,
    order_by,
    prompt_versions_select_column,
    prompts_select_column,
    source_types_enum,
    sources_constraint,
    sources_select_column,
    sources_update_column,
    statuses_enum,
    tool_names_enum,
    tools_select_column,
    workspace_roles_enum,
)


class Boolean_comparison_exp(BaseModel):
    eq: Optional[bool] = Field(alias="_eq", default=None)
    gt: Optional[bool] = Field(alias="_gt", default=None)
    gte: Optional[bool] = Field(alias="_gte", default=None)
    in_: Optional[List[bool]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    lt: Optional[bool] = Field(alias="_lt", default=None)
    lte: Optional[bool] = Field(alias="_lte", default=None)
    neq: Optional[bool] = Field(alias="_neq", default=None)
    nin: Optional[List[bool]] = Field(alias="_nin", default=None)


class Int_comparison_exp(BaseModel):
    eq: Optional[int] = Field(alias="_eq", default=None)
    gt: Optional[int] = Field(alias="_gt", default=None)
    gte: Optional[int] = Field(alias="_gte", default=None)
    in_: Optional[List[int]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    lt: Optional[int] = Field(alias="_lt", default=None)
    lte: Optional[int] = Field(alias="_lte", default=None)
    neq: Optional[int] = Field(alias="_neq", default=None)
    nin: Optional[List[int]] = Field(alias="_nin", default=None)


class RefreshInput(BaseModel):
    refresh_token: str = Field(alias="refreshToken")


class SignOutInput(BaseModel):
    all: Optional[bool] = None
    refresh_token: str = Field(alias="refreshToken")


class String_comparison_exp(BaseModel):
    eq: Optional[str] = Field(alias="_eq", default=None)
    gt: Optional[str] = Field(alias="_gt", default=None)
    gte: Optional[str] = Field(alias="_gte", default=None)
    ilike: Optional[str] = Field(alias="_ilike", default=None)
    in_: Optional[List[str]] = Field(alias="_in", default=None)
    iregex: Optional[str] = Field(alias="_iregex", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    like: Optional[str] = Field(alias="_like", default=None)
    lt: Optional[str] = Field(alias="_lt", default=None)
    lte: Optional[str] = Field(alias="_lte", default=None)
    neq: Optional[str] = Field(alias="_neq", default=None)
    nilike: Optional[str] = Field(alias="_nilike", default=None)
    nin: Optional[List[str]] = Field(alias="_nin", default=None)
    niregex: Optional[str] = Field(alias="_niregex", default=None)
    nlike: Optional[str] = Field(alias="_nlike", default=None)
    nregex: Optional[str] = Field(alias="_nregex", default=None)
    nsimilar: Optional[str] = Field(alias="_nsimilar", default=None)
    regex: Optional[str] = Field(alias="_regex", default=None)
    similar: Optional[str] = Field(alias="_similar", default=None)


class agents_aggregate_bool_exp(BaseModel):
    count: Optional["agents_aggregate_bool_exp_count"] = None


class agents_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[agents_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["agents_bool_exp"] = None
    predicate: "Int_comparison_exp"


class agents_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["agents_max_order_by"] = None
    min: Optional["agents_min_order_by"] = None


class agents_bool_exp(BaseModel):
    and_: Optional[List["agents_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["agents_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["agents_bool_exp"]] = Field(alias="_or", default=None)
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    integration: Optional["integrations_bool_exp"] = None
    integration_id: Optional["uuid_comparison_exp"] = None
    name: Optional["String_comparison_exp"] = None
    persona: Optional["String_comparison_exp"] = None
    prompt: Optional["prompts_bool_exp"] = None
    prompt_id: Optional["uuid_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class agents_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    integration_id: Optional[order_by] = None
    name: Optional[order_by] = None
    persona: Optional[order_by] = None
    prompt_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class agents_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    integration_id: Optional[order_by] = None
    name: Optional[order_by] = None
    persona: Optional[order_by] = None
    prompt_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class agents_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    integration: Optional["integrations_order_by"] = None
    integration_id: Optional[order_by] = None
    name: Optional[order_by] = None
    persona: Optional[order_by] = None
    prompt: Optional["prompts_order_by"] = None
    prompt_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class agents_stream_cursor_input(BaseModel):
    initial_value: "agents_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class agents_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    integration_id: Optional[Any] = None
    name: Optional[str] = None
    persona: Optional[str] = None
    prompt_id: Optional[Any] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None
    workspace_id: Optional[Any] = None


class authRefreshTokenTypes_enum_comparison_exp(BaseModel):
    eq: Optional[authRefreshTokenTypes_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[authRefreshTokenTypes_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[authRefreshTokenTypes_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[authRefreshTokenTypes_enum]] = Field(alias="_nin", default=None)


class authRefreshTokens_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["authRefreshTokens_max_order_by"] = None
    min: Optional["authRefreshTokens_min_order_by"] = None


class authRefreshTokens_bool_exp(BaseModel):
    and_: Optional[List["authRefreshTokens_bool_exp"]] = Field(
        alias="_and", default=None
    )
    not_: Optional["authRefreshTokens_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["authRefreshTokens_bool_exp"]] = Field(alias="_or", default=None)
    created_at: Optional["timestamptz_comparison_exp"] = Field(
        alias="createdAt", default=None
    )
    expires_at: Optional["timestamptz_comparison_exp"] = Field(
        alias="expiresAt", default=None
    )
    id: Optional["uuid_comparison_exp"] = None
    metadata: Optional["jsonb_comparison_exp"] = None
    type: Optional["authRefreshTokenTypes_enum_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = Field(alias="userId", default=None)


class authRefreshTokens_max_order_by(BaseModel):
    created_at: Optional[order_by] = Field(alias="createdAt", default=None)
    expires_at: Optional[order_by] = Field(alias="expiresAt", default=None)
    id: Optional[order_by] = None
    user_id: Optional[order_by] = Field(alias="userId", default=None)


class authRefreshTokens_min_order_by(BaseModel):
    created_at: Optional[order_by] = Field(alias="createdAt", default=None)
    expires_at: Optional[order_by] = Field(alias="expiresAt", default=None)
    id: Optional[order_by] = None
    user_id: Optional[order_by] = Field(alias="userId", default=None)


class authRefreshTokens_order_by(BaseModel):
    created_at: Optional[order_by] = Field(alias="createdAt", default=None)
    expires_at: Optional[order_by] = Field(alias="expiresAt", default=None)
    id: Optional[order_by] = None
    metadata: Optional[order_by] = None
    type: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = Field(alias="userId", default=None)


class authRefreshTokens_stream_cursor_input(BaseModel):
    initial_value: "authRefreshTokens_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class authRefreshTokens_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = Field(alias="createdAt", default=None)
    expires_at: Optional[Any] = Field(alias="expiresAt", default=None)
    id: Optional[Any] = None
    metadata: Optional[Any] = None
    type: Optional[authRefreshTokenTypes_enum] = None
    user_id: Optional[Any] = Field(alias="userId", default=None)


class chat_statuses_enum_comparison_exp(BaseModel):
    eq: Optional[chat_statuses_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[chat_statuses_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[chat_statuses_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[chat_statuses_enum]] = Field(alias="_nin", default=None)


class chats_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["chats_max_order_by"] = None
    min: Optional["chats_min_order_by"] = None


class chats_bool_exp(BaseModel):
    and_: Optional[List["chats_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["chats_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["chats_bool_exp"]] = Field(alias="_or", default=None)
    channel_id: Optional["String_comparison_exp"] = None
    contact_id: Optional["String_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    crm_records: Optional["crm_records_bool_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    last_message_at: Optional["timestamptz_comparison_exp"] = None
    messages: Optional["jsonb_comparison_exp"] = None
    platform_id: Optional["String_comparison_exp"] = None
    source: Optional["sources_bool_exp"] = None
    source_id: Optional["uuid_comparison_exp"] = None
    status: Optional["chat_statuses_enum_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class chats_max_order_by(BaseModel):
    channel_id: Optional[order_by] = None
    contact_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    last_message_at: Optional[order_by] = None
    platform_id: Optional[order_by] = None
    source_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class chats_min_order_by(BaseModel):
    channel_id: Optional[order_by] = None
    contact_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    last_message_at: Optional[order_by] = None
    platform_id: Optional[order_by] = None
    source_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class chats_order_by(BaseModel):
    channel_id: Optional[order_by] = None
    contact_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    crm_records_aggregate: Optional["crm_records_aggregate_order_by"] = None
    id: Optional[order_by] = None
    last_message_at: Optional[order_by] = None
    messages: Optional[order_by] = None
    platform_id: Optional[order_by] = None
    source: Optional["sources_order_by"] = None
    source_id: Optional[order_by] = None
    status: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class chats_stream_cursor_input(BaseModel):
    initial_value: "chats_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class chats_stream_cursor_value_input(BaseModel):
    channel_id: Optional[str] = None
    contact_id: Optional[str] = None
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    last_message_at: Optional[Any] = None
    messages: Optional[Any] = None
    platform_id: Optional[str] = None
    source_id: Optional[Any] = None
    status: Optional[chat_statuses_enum] = None
    updated_at: Optional[Any] = None
    workspace_id: Optional[Any] = None


class citext_comparison_exp(BaseModel):
    eq: Optional[Any] = Field(alias="_eq", default=None)
    gt: Optional[Any] = Field(alias="_gt", default=None)
    gte: Optional[Any] = Field(alias="_gte", default=None)
    ilike: Optional[Any] = Field(alias="_ilike", default=None)
    in_: Optional[List[Any]] = Field(alias="_in", default=None)
    iregex: Optional[Any] = Field(alias="_iregex", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    like: Optional[Any] = Field(alias="_like", default=None)
    lt: Optional[Any] = Field(alias="_lt", default=None)
    lte: Optional[Any] = Field(alias="_lte", default=None)
    neq: Optional[Any] = Field(alias="_neq", default=None)
    nilike: Optional[Any] = Field(alias="_nilike", default=None)
    nin: Optional[List[Any]] = Field(alias="_nin", default=None)
    niregex: Optional[Any] = Field(alias="_niregex", default=None)
    nlike: Optional[Any] = Field(alias="_nlike", default=None)
    nregex: Optional[Any] = Field(alias="_nregex", default=None)
    nsimilar: Optional[Any] = Field(alias="_nsimilar", default=None)
    regex: Optional[Any] = Field(alias="_regex", default=None)
    similar: Optional[Any] = Field(alias="_similar", default=None)


class connections_aggregate_bool_exp(BaseModel):
    bool_and: Optional["connections_aggregate_bool_exp_bool_and"] = None
    bool_or: Optional["connections_aggregate_bool_exp_bool_or"] = None
    count: Optional["connections_aggregate_bool_exp_count"] = None


class connections_aggregate_bool_exp_bool_and(BaseModel):
    arguments: connections_select_column_connections_aggregate_bool_exp_bool_and_arguments_columns
    distinct: Optional[bool] = None
    filter: Optional["connections_bool_exp"] = None
    predicate: "Boolean_comparison_exp"


class connections_aggregate_bool_exp_bool_or(BaseModel):
    arguments: connections_select_column_connections_aggregate_bool_exp_bool_or_arguments_columns
    distinct: Optional[bool] = None
    filter: Optional["connections_bool_exp"] = None
    predicate: "Boolean_comparison_exp"


class connections_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[connections_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["connections_bool_exp"] = None
    predicate: "Int_comparison_exp"


class connections_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["connections_max_order_by"] = None
    min: Optional["connections_min_order_by"] = None


class connections_arr_rel_insert_input(BaseModel):
    data: List["connections_insert_input"]
    on_conflict: Optional["connections_on_conflict"] = None


class connections_bool_exp(BaseModel):
    and_: Optional[List["connections_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["connections_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["connections_bool_exp"]] = Field(alias="_or", default=None)
    active: Optional["Boolean_comparison_exp"] = None
    config: Optional["jsonb_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    destination: Optional["destinations_bool_exp"] = None
    destination_id: Optional["uuid_comparison_exp"] = None
    handlers: Optional["handlers_bool_exp"] = None
    handlers_aggregate: Optional["handlers_aggregate_bool_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    source: Optional["sources_bool_exp"] = None
    source_id: Optional["uuid_comparison_exp"] = None
    state: Optional["jsonb_comparison_exp"] = None
    status: Optional["statuses_enum_comparison_exp"] = None
    tools: Optional["tools_bool_exp"] = None
    tools_aggregate: Optional["tools_aggregate_bool_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class connections_insert_input(BaseModel):
    destination_id: Optional[Any] = None
    source: Optional["sources_obj_rel_insert_input"] = None
    source_id: Optional[Any] = None
    workspace_id: Optional[Any] = None


class connections_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    destination_id: Optional[order_by] = None
    id: Optional[order_by] = None
    source_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class connections_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    destination_id: Optional[order_by] = None
    id: Optional[order_by] = None
    source_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class connections_on_conflict(BaseModel):
    constraint: connections_constraint
    update_columns: List[connections_update_column]
    where: Optional["connections_bool_exp"] = None


class connections_order_by(BaseModel):
    active: Optional[order_by] = None
    config: Optional[order_by] = None
    created_at: Optional[order_by] = None
    destination: Optional["destinations_order_by"] = None
    destination_id: Optional[order_by] = None
    handlers_aggregate: Optional["handlers_aggregate_order_by"] = None
    id: Optional[order_by] = None
    source: Optional["sources_order_by"] = None
    source_id: Optional[order_by] = None
    state: Optional[order_by] = None
    status: Optional[order_by] = None
    tools_aggregate: Optional["tools_aggregate_order_by"] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class connections_stream_cursor_input(BaseModel):
    initial_value: "connections_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class connections_stream_cursor_value_input(BaseModel):
    active: Optional[bool] = None
    config: Optional[Any] = None
    created_at: Optional[Any] = None
    destination_id: Optional[Any] = None
    id: Optional[Any] = None
    source_id: Optional[Any] = None
    state: Optional[Any] = None
    status: Optional[statuses_enum] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None
    workspace_id: Optional[Any] = None


class crm_record_types_enum_comparison_exp(BaseModel):
    eq: Optional[crm_record_types_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[crm_record_types_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[crm_record_types_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[crm_record_types_enum]] = Field(alias="_nin", default=None)


class crm_records_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["crm_records_max_order_by"] = None
    min: Optional["crm_records_min_order_by"] = None


class crm_records_bool_exp(BaseModel):
    and_: Optional[List["crm_records_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["crm_records_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["crm_records_bool_exp"]] = Field(alias="_or", default=None)
    attributes: Optional["jsonb_comparison_exp"] = None
    chat: Optional["chats_bool_exp"] = None
    chat_id: Optional["uuid_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    source: Optional["sources_bool_exp"] = None
    source_id: Optional["uuid_comparison_exp"] = None
    type: Optional["crm_record_types_enum_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None


class crm_records_max_order_by(BaseModel):
    chat_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    source_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class crm_records_min_order_by(BaseModel):
    chat_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    source_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class crm_records_order_by(BaseModel):
    attributes: Optional[order_by] = None
    chat: Optional["chats_order_by"] = None
    chat_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    source: Optional["sources_order_by"] = None
    source_id: Optional[order_by] = None
    type: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class crm_records_stream_cursor_input(BaseModel):
    initial_value: "crm_records_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class crm_records_stream_cursor_value_input(BaseModel):
    attributes: Optional[Any] = None
    chat_id: Optional[Any] = None
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    source_id: Optional[Any] = None
    type: Optional[crm_record_types_enum] = None
    updated_at: Optional[Any] = None


class destinations_bool_exp(BaseModel):
    and_: Optional[List["destinations_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["destinations_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["destinations_bool_exp"]] = Field(alias="_or", default=None)
    connections: Optional["connections_bool_exp"] = None
    connections_aggregate: Optional["connections_aggregate_bool_exp"] = None
    id: Optional["uuid_comparison_exp"] = None


class destinations_order_by(BaseModel):
    connections_aggregate: Optional["connections_aggregate_order_by"] = None
    id: Optional[order_by] = None


class destinations_stream_cursor_input(BaseModel):
    initial_value: "destinations_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class destinations_stream_cursor_value_input(BaseModel):
    id: Optional[Any] = None


class environments_enum_comparison_exp(BaseModel):
    eq: Optional[environments_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[environments_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[environments_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[environments_enum]] = Field(alias="_nin", default=None)


class handler_names_enum_comparison_exp(BaseModel):
    eq: Optional[handler_names_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[handler_names_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[handler_names_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[handler_names_enum]] = Field(alias="_nin", default=None)


class handlers_aggregate_bool_exp(BaseModel):
    count: Optional["handlers_aggregate_bool_exp_count"] = None


class handlers_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[handlers_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["handlers_bool_exp"] = None
    predicate: "Int_comparison_exp"


class handlers_aggregate_order_by(BaseModel):
    avg: Optional["handlers_avg_order_by"] = None
    count: Optional[order_by] = None
    max: Optional["handlers_max_order_by"] = None
    min: Optional["handlers_min_order_by"] = None
    stddev: Optional["handlers_stddev_order_by"] = None
    stddev_pop: Optional["handlers_stddev_pop_order_by"] = None
    stddev_samp: Optional["handlers_stddev_samp_order_by"] = None
    sum: Optional["handlers_sum_order_by"] = None
    var_pop: Optional["handlers_var_pop_order_by"] = None
    var_samp: Optional["handlers_var_samp_order_by"] = None
    variance: Optional["handlers_variance_order_by"] = None


class handlers_avg_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_bool_exp(BaseModel):
    and_: Optional[List["handlers_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["handlers_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["handlers_bool_exp"]] = Field(alias="_or", default=None)
    connection: Optional["connections_bool_exp"] = None
    connection_id: Optional["uuid_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    name: Optional["handler_names_enum_comparison_exp"] = None
    params: Optional["jsonb_comparison_exp"] = None
    sequence: Optional["Int_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None


class handlers_max_order_by(BaseModel):
    connection_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    sequence: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class handlers_min_order_by(BaseModel):
    connection_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    sequence: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class handlers_order_by(BaseModel):
    connection: Optional["connections_order_by"] = None
    connection_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    params: Optional[order_by] = None
    sequence: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class handlers_stddev_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_stddev_pop_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_stddev_samp_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_stream_cursor_input(BaseModel):
    initial_value: "handlers_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class handlers_stream_cursor_value_input(BaseModel):
    connection_id: Optional[Any] = None
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    name: Optional[handler_names_enum] = None
    params: Optional[Any] = None
    sequence: Optional[int] = None
    updated_at: Optional[Any] = None


class handlers_sum_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_var_pop_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_var_samp_order_by(BaseModel):
    sequence: Optional[order_by] = None


class handlers_variance_order_by(BaseModel):
    sequence: Optional[order_by] = None


class integration_types_enum_comparison_exp(BaseModel):
    eq: Optional[integration_types_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[integration_types_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[integration_types_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[integration_types_enum]] = Field(alias="_nin", default=None)


class integrations_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["integrations_max_order_by"] = None
    min: Optional["integrations_min_order_by"] = None


class integrations_bool_exp(BaseModel):
    and_: Optional[List["integrations_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["integrations_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["integrations_bool_exp"]] = Field(alias="_or", default=None)
    agents: Optional["agents_bool_exp"] = None
    agents_aggregate: Optional["agents_aggregate_bool_exp"] = None
    config: Optional["jsonb_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    name: Optional["String_comparison_exp"] = None
    type: Optional["integration_types_enum_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class integrations_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class integrations_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class integrations_order_by(BaseModel):
    agents_aggregate: Optional["agents_aggregate_order_by"] = None
    config: Optional[order_by] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    type: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class integrations_stream_cursor_input(BaseModel):
    initial_value: "integrations_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class integrations_stream_cursor_value_input(BaseModel):
    config: Optional[Any] = None
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    name: Optional[str] = None
    type: Optional[integration_types_enum] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None
    workspace_id: Optional[Any] = None


class jsonb_cast_exp(BaseModel):
    string: Optional["String_comparison_exp"] = Field(alias="String", default=None)


class jsonb_comparison_exp(BaseModel):
    cast: Optional["jsonb_cast_exp"] = Field(alias="_cast", default=None)
    contained_in: Optional[Any] = Field(alias="_contained_in", default=None)
    contains: Optional[Any] = Field(alias="_contains", default=None)
    eq: Optional[Any] = Field(alias="_eq", default=None)
    gt: Optional[Any] = Field(alias="_gt", default=None)
    gte: Optional[Any] = Field(alias="_gte", default=None)
    has_key: Optional[str] = Field(alias="_has_key", default=None)
    has_keys_all: Optional[List[str]] = Field(alias="_has_keys_all", default=None)
    has_keys_any: Optional[List[str]] = Field(alias="_has_keys_any", default=None)
    in_: Optional[List[Any]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    lt: Optional[Any] = Field(alias="_lt", default=None)
    lte: Optional[Any] = Field(alias="_lte", default=None)
    neq: Optional[Any] = Field(alias="_neq", default=None)
    nin: Optional[List[Any]] = Field(alias="_nin", default=None)


class oauth_apps_bool_exp(BaseModel):
    and_: Optional[List["oauth_apps_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["oauth_apps_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["oauth_apps_bool_exp"]] = Field(alias="_or", default=None)
    callback_url: Optional["String_comparison_exp"] = None
    client_id: Optional["String_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    environment: Optional["environments_enum_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    logo_url: Optional["String_comparison_exp"] = None
    name: Optional["String_comparison_exp"] = None
    type: Optional["source_types_enum_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None


class oauth_apps_order_by(BaseModel):
    callback_url: Optional[order_by] = None
    client_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    environment: Optional[order_by] = None
    id: Optional[order_by] = None
    logo_url: Optional[order_by] = None
    name: Optional[order_by] = None
    type: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class oauth_apps_stream_cursor_input(BaseModel):
    initial_value: "oauth_apps_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class oauth_apps_stream_cursor_value_input(BaseModel):
    callback_url: Optional[str] = None
    client_id: Optional[str] = None
    created_at: Optional[Any] = None
    environment: Optional[environments_enum] = None
    id: Optional[Any] = None
    logo_url: Optional[str] = None
    name: Optional[str] = None
    type: Optional[source_types_enum] = None
    updated_at: Optional[Any] = None


class prompt_versions_aggregate_bool_exp(BaseModel):
    count: Optional["prompt_versions_aggregate_bool_exp_count"] = None


class prompt_versions_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[prompt_versions_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["prompt_versions_bool_exp"] = None
    predicate: "Int_comparison_exp"


class prompt_versions_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["prompt_versions_max_order_by"] = None
    min: Optional["prompt_versions_min_order_by"] = None


class prompt_versions_bool_exp(BaseModel):
    and_: Optional[List["prompt_versions_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["prompt_versions_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["prompt_versions_bool_exp"]] = Field(alias="_or", default=None)
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    prompt: Optional["prompts_bool_exp"] = None
    prompt_id: Optional["uuid_comparison_exp"] = None
    script: Optional["String_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None


class prompt_versions_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    prompt_id: Optional[order_by] = None
    script: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None


class prompt_versions_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    prompt_id: Optional[order_by] = None
    script: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None


class prompt_versions_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    prompt: Optional["prompts_order_by"] = None
    prompt_id: Optional[order_by] = None
    script: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None


class prompt_versions_stream_cursor_input(BaseModel):
    initial_value: "prompt_versions_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class prompt_versions_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    prompt_id: Optional[Any] = None
    script: Optional[str] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None


class prompts_aggregate_bool_exp(BaseModel):
    count: Optional["prompts_aggregate_bool_exp_count"] = None


class prompts_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[prompts_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["prompts_bool_exp"] = None
    predicate: "Int_comparison_exp"


class prompts_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["prompts_max_order_by"] = None
    min: Optional["prompts_min_order_by"] = None


class prompts_bool_exp(BaseModel):
    and_: Optional[List["prompts_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["prompts_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["prompts_bool_exp"]] = Field(alias="_or", default=None)
    agents: Optional["agents_bool_exp"] = None
    agents_aggregate: Optional["agents_aggregate_bool_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    description: Optional["String_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    name: Optional["String_comparison_exp"] = None
    prompt_versions: Optional["prompt_versions_bool_exp"] = None
    prompt_versions_aggregate: Optional["prompt_versions_aggregate_bool_exp"] = None
    tools: Optional["tools_bool_exp"] = None
    tools_aggregate: Optional["tools_aggregate_bool_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class prompts_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    description: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class prompts_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    description: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class prompts_order_by(BaseModel):
    agents_aggregate: Optional["agents_aggregate_order_by"] = None
    created_at: Optional[order_by] = None
    description: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    prompt_versions_aggregate: Optional["prompt_versions_aggregate_order_by"] = None
    tools_aggregate: Optional["tools_aggregate_order_by"] = None
    updated_at: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class prompts_stream_cursor_input(BaseModel):
    initial_value: "prompts_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class prompts_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = None
    description: Optional[str] = None
    id: Optional[Any] = None
    name: Optional[str] = None
    updated_at: Optional[Any] = None
    workspace_id: Optional[Any] = None


class source_types_enum_comparison_exp(BaseModel):
    eq: Optional[source_types_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[source_types_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[source_types_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[source_types_enum]] = Field(alias="_nin", default=None)


class sources_aggregate_bool_exp(BaseModel):
    count: Optional["sources_aggregate_bool_exp_count"] = None


class sources_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[sources_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["sources_bool_exp"] = None
    predicate: "Int_comparison_exp"


class sources_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["sources_max_order_by"] = None
    min: Optional["sources_min_order_by"] = None


class sources_append_input(BaseModel):
    config: Optional[Any] = None


class sources_bool_exp(BaseModel):
    and_: Optional[List["sources_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["sources_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["sources_bool_exp"]] = Field(alias="_or", default=None)
    chats: Optional["chats_bool_exp"] = None
    config: Optional["jsonb_comparison_exp"] = None
    connections: Optional["connections_bool_exp"] = None
    connections_aggregate: Optional["connections_aggregate_bool_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    crm_records: Optional["crm_records_bool_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    name: Optional["String_comparison_exp"] = None
    oauth_app: Optional["oauth_apps_bool_exp"] = None
    oauth_app_id: Optional["uuid_comparison_exp"] = None
    type: Optional["source_types_enum_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class sources_delete_at_path_input(BaseModel):
    config: Optional[List[str]] = None


class sources_delete_elem_input(BaseModel):
    config: Optional[int] = None


class sources_delete_key_input(BaseModel):
    config: Optional[str] = None


class sources_insert_input(BaseModel):
    connections: Optional["connections_arr_rel_insert_input"] = None
    name: Optional[str] = None
    oauth_app_id: Optional[Any] = None
    type: Optional[source_types_enum] = None
    workspace_id: Optional[Any] = None


class sources_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    oauth_app_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class sources_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    oauth_app_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class sources_obj_rel_insert_input(BaseModel):
    data: "sources_insert_input"
    on_conflict: Optional["sources_on_conflict"] = None


class sources_on_conflict(BaseModel):
    constraint: sources_constraint
    update_columns: List[sources_update_column]
    where: Optional["sources_bool_exp"] = None


class sources_order_by(BaseModel):
    chats_aggregate: Optional["chats_aggregate_order_by"] = None
    config: Optional[order_by] = None
    connections_aggregate: Optional["connections_aggregate_order_by"] = None
    created_at: Optional[order_by] = None
    crm_records_aggregate: Optional["crm_records_aggregate_order_by"] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    oauth_app: Optional["oauth_apps_order_by"] = None
    oauth_app_id: Optional[order_by] = None
    type: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class sources_pk_columns_input(BaseModel):
    id: Any


class sources_prepend_input(BaseModel):
    config: Optional[Any] = None


class sources_set_input(BaseModel):
    config: Optional[Any] = None


class sources_stream_cursor_input(BaseModel):
    initial_value: "sources_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class sources_stream_cursor_value_input(BaseModel):
    config: Optional[Any] = None
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    name: Optional[str] = None
    oauth_app_id: Optional[Any] = None
    type: Optional[source_types_enum] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None
    workspace_id: Optional[Any] = None


class sources_updates(BaseModel):
    append: Optional["sources_append_input"] = Field(alias="_append", default=None)
    delete_at_path: Optional["sources_delete_at_path_input"] = Field(
        alias="_delete_at_path", default=None
    )
    delete_elem: Optional["sources_delete_elem_input"] = Field(
        alias="_delete_elem", default=None
    )
    delete_key: Optional["sources_delete_key_input"] = Field(
        alias="_delete_key", default=None
    )
    prepend: Optional["sources_prepend_input"] = Field(alias="_prepend", default=None)
    set: Optional["sources_set_input"] = Field(alias="_set", default=None)
    where: "sources_bool_exp"


class statuses_enum_comparison_exp(BaseModel):
    eq: Optional[statuses_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[statuses_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[statuses_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[statuses_enum]] = Field(alias="_nin", default=None)


class timestamptz_comparison_exp(BaseModel):
    eq: Optional[Any] = Field(alias="_eq", default=None)
    gt: Optional[Any] = Field(alias="_gt", default=None)
    gte: Optional[Any] = Field(alias="_gte", default=None)
    in_: Optional[List[Any]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    lt: Optional[Any] = Field(alias="_lt", default=None)
    lte: Optional[Any] = Field(alias="_lte", default=None)
    neq: Optional[Any] = Field(alias="_neq", default=None)
    nin: Optional[List[Any]] = Field(alias="_nin", default=None)


class tool_names_enum_comparison_exp(BaseModel):
    eq: Optional[tool_names_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[tool_names_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[tool_names_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[tool_names_enum]] = Field(alias="_nin", default=None)


class tools_aggregate_bool_exp(BaseModel):
    count: Optional["tools_aggregate_bool_exp_count"] = None


class tools_aggregate_bool_exp_count(BaseModel):
    arguments: Optional[List[tools_select_column]] = None
    distinct: Optional[bool] = None
    filter: Optional["tools_bool_exp"] = None
    predicate: "Int_comparison_exp"


class tools_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["tools_max_order_by"] = None
    min: Optional["tools_min_order_by"] = None


class tools_bool_exp(BaseModel):
    and_: Optional[List["tools_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["tools_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["tools_bool_exp"]] = Field(alias="_or", default=None)
    config: Optional["jsonb_comparison_exp"] = None
    connection: Optional["connections_bool_exp"] = None
    connection_id: Optional["uuid_comparison_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    description: Optional["String_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    name: Optional["tool_names_enum_comparison_exp"] = None
    prompt: Optional["prompts_bool_exp"] = None
    prompt_id: Optional["uuid_comparison_exp"] = None
    properties: Optional["jsonb_comparison_exp"] = None
    required: Optional["jsonb_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None


class tools_max_order_by(BaseModel):
    connection_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    description: Optional[order_by] = None
    id: Optional[order_by] = None
    prompt_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class tools_min_order_by(BaseModel):
    connection_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    description: Optional[order_by] = None
    id: Optional[order_by] = None
    prompt_id: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class tools_order_by(BaseModel):
    config: Optional[order_by] = None
    connection: Optional["connections_order_by"] = None
    connection_id: Optional[order_by] = None
    created_at: Optional[order_by] = None
    description: Optional[order_by] = None
    id: Optional[order_by] = None
    name: Optional[order_by] = None
    prompt: Optional["prompts_order_by"] = None
    prompt_id: Optional[order_by] = None
    properties: Optional[order_by] = None
    required: Optional[order_by] = None
    updated_at: Optional[order_by] = None


class tools_stream_cursor_input(BaseModel):
    initial_value: "tools_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class tools_stream_cursor_value_input(BaseModel):
    config: Optional[Any] = None
    connection_id: Optional[Any] = None
    created_at: Optional[Any] = None
    description: Optional[str] = None
    id: Optional[Any] = None
    name: Optional[tool_names_enum] = None
    prompt_id: Optional[Any] = None
    properties: Optional[Any] = None
    required: Optional[Any] = None
    updated_at: Optional[Any] = None


class user_workspaces_aggregate_order_by(BaseModel):
    count: Optional[order_by] = None
    max: Optional["user_workspaces_max_order_by"] = None
    min: Optional["user_workspaces_min_order_by"] = None


class user_workspaces_bool_exp(BaseModel):
    and_: Optional[List["user_workspaces_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["user_workspaces_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["user_workspaces_bool_exp"]] = Field(alias="_or", default=None)
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    role: Optional["workspace_roles_enum_comparison_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None
    workspace_id: Optional["uuid_comparison_exp"] = None


class user_workspaces_max_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class user_workspaces_min_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user_id: Optional[order_by] = None
    workspace_id: Optional[order_by] = None


class user_workspaces_order_by(BaseModel):
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    role: Optional[order_by] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None
    workspace: Optional["workspaces_order_by"] = None
    workspace_id: Optional[order_by] = None


class user_workspaces_stream_cursor_input(BaseModel):
    initial_value: "user_workspaces_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class user_workspaces_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    role: Optional[workspace_roles_enum] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None
    workspace_id: Optional[Any] = None


class users_bool_exp(BaseModel):
    and_: Optional[List["users_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["users_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["users_bool_exp"]] = Field(alias="_or", default=None)
    agents: Optional["agents_bool_exp"] = None
    agents_aggregate: Optional["agents_aggregate_bool_exp"] = None
    connections: Optional["connections_bool_exp"] = None
    connections_aggregate: Optional["connections_aggregate_bool_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = Field(
        alias="createdAt", default=None
    )
    display_name: Optional["String_comparison_exp"] = Field(
        alias="displayName", default=None
    )
    email: Optional["citext_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    integrations: Optional["integrations_bool_exp"] = None
    prompt_versions: Optional["prompt_versions_bool_exp"] = None
    prompt_versions_aggregate: Optional["prompt_versions_aggregate_bool_exp"] = None
    refresh_tokens: Optional["authRefreshTokens_bool_exp"] = Field(
        alias="refreshTokens", default=None
    )
    updated_at: Optional["timestamptz_comparison_exp"] = Field(
        alias="updatedAt", default=None
    )
    user_workspaces: Optional["user_workspaces_bool_exp"] = None
    workspace: Optional["workspaces_bool_exp"] = None


class users_order_by(BaseModel):
    agents_aggregate: Optional["agents_aggregate_order_by"] = None
    connections_aggregate: Optional["connections_aggregate_order_by"] = None
    created_at: Optional[order_by] = Field(alias="createdAt", default=None)
    display_name: Optional[order_by] = Field(alias="displayName", default=None)
    email: Optional[order_by] = None
    id: Optional[order_by] = None
    integrations_aggregate: Optional["integrations_aggregate_order_by"] = None
    prompt_versions_aggregate: Optional["prompt_versions_aggregate_order_by"] = None
    refresh_tokens_aggregate: Optional["authRefreshTokens_aggregate_order_by"] = Field(
        alias="refreshTokens_aggregate", default=None
    )
    updated_at: Optional[order_by] = Field(alias="updatedAt", default=None)
    user_workspaces_aggregate: Optional["user_workspaces_aggregate_order_by"] = None
    workspace: Optional["workspaces_order_by"] = None


class users_stream_cursor_input(BaseModel):
    initial_value: "users_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class users_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = Field(alias="createdAt", default=None)
    display_name: Optional[str] = Field(alias="displayName", default=None)
    email: Optional[Any] = None
    id: Optional[Any] = None
    updated_at: Optional[Any] = Field(alias="updatedAt", default=None)


class uuid_comparison_exp(BaseModel):
    eq: Optional[Any] = Field(alias="_eq", default=None)
    gt: Optional[Any] = Field(alias="_gt", default=None)
    gte: Optional[Any] = Field(alias="_gte", default=None)
    in_: Optional[List[Any]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    lt: Optional[Any] = Field(alias="_lt", default=None)
    lte: Optional[Any] = Field(alias="_lte", default=None)
    neq: Optional[Any] = Field(alias="_neq", default=None)
    nin: Optional[List[Any]] = Field(alias="_nin", default=None)


class workspace_roles_enum_comparison_exp(BaseModel):
    eq: Optional[workspace_roles_enum] = Field(alias="_eq", default=None)
    in_: Optional[List[workspace_roles_enum]] = Field(alias="_in", default=None)
    is_null: Optional[bool] = Field(alias="_is_null", default=None)
    neq: Optional[workspace_roles_enum] = Field(alias="_neq", default=None)
    nin: Optional[List[workspace_roles_enum]] = Field(alias="_nin", default=None)


class workspaces_bool_exp(BaseModel):
    and_: Optional[List["workspaces_bool_exp"]] = Field(alias="_and", default=None)
    not_: Optional["workspaces_bool_exp"] = Field(alias="_not", default=None)
    or_: Optional[List["workspaces_bool_exp"]] = Field(alias="_or", default=None)
    agents: Optional["agents_bool_exp"] = None
    agents_aggregate: Optional["agents_aggregate_bool_exp"] = None
    chats: Optional["chats_bool_exp"] = None
    connections: Optional["connections_bool_exp"] = None
    connections_aggregate: Optional["connections_aggregate_bool_exp"] = None
    created_at: Optional["timestamptz_comparison_exp"] = None
    id: Optional["uuid_comparison_exp"] = None
    integrations: Optional["integrations_bool_exp"] = None
    name: Optional["String_comparison_exp"] = None
    prompts: Optional["prompts_bool_exp"] = None
    prompts_aggregate: Optional["prompts_aggregate_bool_exp"] = None
    sources: Optional["sources_bool_exp"] = None
    sources_aggregate: Optional["sources_aggregate_bool_exp"] = None
    updated_at: Optional["timestamptz_comparison_exp"] = None
    user: Optional["users_bool_exp"] = None
    user_id: Optional["uuid_comparison_exp"] = None
    user_workspaces: Optional["user_workspaces_bool_exp"] = None


class workspaces_order_by(BaseModel):
    agents_aggregate: Optional["agents_aggregate_order_by"] = None
    chats_aggregate: Optional["chats_aggregate_order_by"] = None
    connections_aggregate: Optional["connections_aggregate_order_by"] = None
    created_at: Optional[order_by] = None
    id: Optional[order_by] = None
    integrations_aggregate: Optional["integrations_aggregate_order_by"] = None
    name: Optional[order_by] = None
    prompts_aggregate: Optional["prompts_aggregate_order_by"] = None
    sources_aggregate: Optional["sources_aggregate_order_by"] = None
    updated_at: Optional[order_by] = None
    user: Optional["users_order_by"] = None
    user_id: Optional[order_by] = None
    user_workspaces_aggregate: Optional["user_workspaces_aggregate_order_by"] = None


class workspaces_stream_cursor_input(BaseModel):
    initial_value: "workspaces_stream_cursor_value_input"
    ordering: Optional[cursor_ordering] = None


class workspaces_stream_cursor_value_input(BaseModel):
    created_at: Optional[Any] = None
    id: Optional[Any] = None
    name: Optional[str] = None
    updated_at: Optional[Any] = None
    user_id: Optional[Any] = None
