# -*- coding: utf-8 -*-
# code generated by Prisma. DO NOT EDIT.
# pyright: reportUnusedImport=false
# fmt: off
from __future__ import annotations

# global imports for type checking
from builtins import bool as _bool
from builtins import int as _int
from builtins import float as _float
from builtins import str as _str
import sys
import decimal
import datetime
from typing import (
    TYPE_CHECKING,
    Optional,
    Iterable,
    Iterator,
    Sequence,
    Callable,
    ClassVar,
    NoReturn,
    TypeVar,
    Generic,
    Mapping,
    Tuple,
    Union,
    List,
    Dict,
    Type,
    Any,
    Set,
    overload,
    cast,
)
from typing_extensions import TypedDict, Literal


LiteralString = str
# -- template client.py.jinja --
import warnings
import logging
from datetime import timedelta
from pathlib import Path
from types import TracebackType

from pydantic import BaseModel

from . import types, models, errors, actions
from .types import DatasourceOverride, HttpConfig, MetricsFormat
from ._types import BaseModelT, PrismaMethod
from .bases import _PrismaModel
from .engine import AbstractEngine, QueryEngine, TransactionId
from .builder import QueryBuilder, dumps
from .generator.models import EngineType, OptionalValueFromEnvVar, BinaryPaths
from ._compat import removeprefix, model_parse
from ._constants import DEFAULT_CONNECT_TIMEOUT, DEFAULT_TX_MAX_WAIT, DEFAULT_TX_TIMEOUT
from ._raw_query import deserialize_raw_results
from ._metrics import Metrics

__all__ = (
    'ENGINE_TYPE',
    'SCHEMA_PATH',
    'BINARY_PATHS',
    'Batch',
    'Prisma',
    'Client',
    'load_env',
    'register',
    'get_client',
)

log: logging.Logger = logging.getLogger(__name__)

SCHEMA_PATH = Path('/app/schema.prisma')
PACKAGED_SCHEMA_PATH = Path(__file__).parent.joinpath('schema.prisma')
ENGINE_TYPE: EngineType = EngineType.binary
BINARY_PATHS = model_parse(BinaryPaths, {'queryEngine': {'debian-openssl-3.0.x': '/root/.cache/prisma-python/binaries/5.4.2/ac9d7041ed77bcc8a8dbd2ab6616b39013829574/node_modules/prisma/query-engine-debian-openssl-3.0.x'}, 'introspectionEngine': {}, 'migrationEngine': {}, 'libqueryEngine': {}, 'prismaFmt': {}})

RegisteredClient = Union['Prisma', Callable[[], 'Prisma']]
_registered_client: Optional[RegisteredClient] = None


class UseClientDefault:
    """For certain parameters such as `timeout=...` we can make our intent more clear
    by typing the parameter with this class rather than using None, for example:

    ```py
    def connect(timeout: Union[int, timedelta, UseClientDefault] = UseClientDefault()) -> None: ...
    ```

    relays the intention more clearly than:

    ```py
    def connect(timeout: Union[int, timedelta, None] = None) -> None: ...
    ```

    This solution also allows us to indicate an "unset" state that is uniquely distinct
    from `None` which may be useful in the future.
    """


_USE_CLIENT_DEFAULT = UseClientDefault()


def load_env(*, override: bool = False, **kwargs: Any) -> None:
    """Load environemntal variables from dotenv files

    Loads from the following files relative to the current
    working directory:

    - .env
    - prisma/.env
    """
    from dotenv import load_dotenv

    load_dotenv('.env', override=override, **kwargs)
    load_dotenv('prisma/.env', override=override, **kwargs)


def register(client: RegisteredClient) -> None:
    """Register a client instance to be retrieved by `get_client()`

    This function _must_ only be called once, preferrably as soon as possible
    to avoid any potentially confusing errors with threads or processes.
    """
    global _registered_client

    if _registered_client is not None:
        raise errors.ClientAlreadyRegisteredError()

    if not isinstance(client, Prisma) and not callable(client):
        raise TypeError(
            f'Expected either a {Prisma} instance or a function that returns a {Prisma} but got {client} instead.'
        )

    _registered_client = client


def get_client() -> 'Prisma':
    """Get the registered client instance

    Raises errors.ClientNotRegisteredError() if no client instance has been registered.
    """
    registered = _registered_client
    if registered is None:
        raise errors.ClientNotRegisteredError() from None

    if isinstance(registered, Prisma):
        return registered

    client = registered()
    if not isinstance(client, Prisma):  # pyright: ignore[reportUnnecessaryIsInstance]
        raise TypeError(
            f'Registered function returned {client} instead of a {Prisma} instance.'
        )

    return client


class Prisma:
    litellm_budgettable: 'actions.LiteLLM_BudgetTableActions[models.LiteLLM_BudgetTable]'
    litellm_credentialstable: 'actions.LiteLLM_CredentialsTableActions[models.LiteLLM_CredentialsTable]'
    litellm_proxymodeltable: 'actions.LiteLLM_ProxyModelTableActions[models.LiteLLM_ProxyModelTable]'
    litellm_organizationtable: 'actions.LiteLLM_OrganizationTableActions[models.LiteLLM_OrganizationTable]'
    litellm_modeltable: 'actions.LiteLLM_ModelTableActions[models.LiteLLM_ModelTable]'
    litellm_teamtable: 'actions.LiteLLM_TeamTableActions[models.LiteLLM_TeamTable]'
    litellm_usertable: 'actions.LiteLLM_UserTableActions[models.LiteLLM_UserTable]'
    litellm_objectpermissiontable: 'actions.LiteLLM_ObjectPermissionTableActions[models.LiteLLM_ObjectPermissionTable]'
    litellm_mcpservertable: 'actions.LiteLLM_MCPServerTableActions[models.LiteLLM_MCPServerTable]'
    litellm_verificationtoken: 'actions.LiteLLM_VerificationTokenActions[models.LiteLLM_VerificationToken]'
    litellm_endusertable: 'actions.LiteLLM_EndUserTableActions[models.LiteLLM_EndUserTable]'
    litellm_config: 'actions.LiteLLM_ConfigActions[models.LiteLLM_Config]'
    litellm_spendlogs: 'actions.LiteLLM_SpendLogsActions[models.LiteLLM_SpendLogs]'
    litellm_errorlogs: 'actions.LiteLLM_ErrorLogsActions[models.LiteLLM_ErrorLogs]'
    litellm_usernotifications: 'actions.LiteLLM_UserNotificationsActions[models.LiteLLM_UserNotifications]'
    litellm_teammembership: 'actions.LiteLLM_TeamMembershipActions[models.LiteLLM_TeamMembership]'
    litellm_organizationmembership: 'actions.LiteLLM_OrganizationMembershipActions[models.LiteLLM_OrganizationMembership]'
    litellm_invitationlink: 'actions.LiteLLM_InvitationLinkActions[models.LiteLLM_InvitationLink]'
    litellm_auditlog: 'actions.LiteLLM_AuditLogActions[models.LiteLLM_AuditLog]'
    litellm_dailyuserspend: 'actions.LiteLLM_DailyUserSpendActions[models.LiteLLM_DailyUserSpend]'
    litellm_dailyteamspend: 'actions.LiteLLM_DailyTeamSpendActions[models.LiteLLM_DailyTeamSpend]'
    litellm_dailytagspend: 'actions.LiteLLM_DailyTagSpendActions[models.LiteLLM_DailyTagSpend]'
    litellm_cronjob: 'actions.LiteLLM_CronJobActions[models.LiteLLM_CronJob]'
    litellm_managedfiletable: 'actions.LiteLLM_ManagedFileTableActions[models.LiteLLM_ManagedFileTable]'
    litellm_managedobjecttable: 'actions.LiteLLM_ManagedObjectTableActions[models.LiteLLM_ManagedObjectTable]'
    litellm_managedvectorstorestable: 'actions.LiteLLM_ManagedVectorStoresTableActions[models.LiteLLM_ManagedVectorStoresTable]'
    litellm_guardrailstable: 'actions.LiteLLM_GuardrailsTableActions[models.LiteLLM_GuardrailsTable]'
    litellm_prompttable: 'actions.LiteLLM_PromptTableActions[models.LiteLLM_PromptTable]'
    litellm_healthchecktable: 'actions.LiteLLM_HealthCheckTableActions[models.LiteLLM_HealthCheckTable]'

    __slots__ = (
        'litellm_budgettable',
        'litellm_credentialstable',
        'litellm_proxymodeltable',
        'litellm_organizationtable',
        'litellm_modeltable',
        'litellm_teamtable',
        'litellm_usertable',
        'litellm_objectpermissiontable',
        'litellm_mcpservertable',
        'litellm_verificationtoken',
        'litellm_endusertable',
        'litellm_config',
        'litellm_spendlogs',
        'litellm_errorlogs',
        'litellm_usernotifications',
        'litellm_teammembership',
        'litellm_organizationmembership',
        'litellm_invitationlink',
        'litellm_auditlog',
        'litellm_dailyuserspend',
        'litellm_dailyteamspend',
        'litellm_dailytagspend',
        'litellm_cronjob',
        'litellm_managedfiletable',
        'litellm_managedobjecttable',
        'litellm_managedvectorstorestable',
        'litellm_guardrailstable',
        'litellm_prompttable',
        'litellm_healthchecktable',
        '__engine',
        '__copied',
        '_tx_id',
        '_datasource',
        '_log_queries',
        '_http_config',
        '_connect_timeout',
        '_active_provider',
    )

    def __init__(
        self,
        *,
        use_dotenv: bool = True,
        log_queries: bool = False,
        auto_register: bool = False,
        datasource: Optional[DatasourceOverride] = None,
        connect_timeout: Union[int, timedelta] = DEFAULT_CONNECT_TIMEOUT,
        http: Optional[HttpConfig] = None,
    ) -> None:
        self.litellm_budgettable = actions.LiteLLM_BudgetTableActions[models.LiteLLM_BudgetTable](self, models.LiteLLM_BudgetTable)
        self.litellm_credentialstable = actions.LiteLLM_CredentialsTableActions[models.LiteLLM_CredentialsTable](self, models.LiteLLM_CredentialsTable)
        self.litellm_proxymodeltable = actions.LiteLLM_ProxyModelTableActions[models.LiteLLM_ProxyModelTable](self, models.LiteLLM_ProxyModelTable)
        self.litellm_organizationtable = actions.LiteLLM_OrganizationTableActions[models.LiteLLM_OrganizationTable](self, models.LiteLLM_OrganizationTable)
        self.litellm_modeltable = actions.LiteLLM_ModelTableActions[models.LiteLLM_ModelTable](self, models.LiteLLM_ModelTable)
        self.litellm_teamtable = actions.LiteLLM_TeamTableActions[models.LiteLLM_TeamTable](self, models.LiteLLM_TeamTable)
        self.litellm_usertable = actions.LiteLLM_UserTableActions[models.LiteLLM_UserTable](self, models.LiteLLM_UserTable)
        self.litellm_objectpermissiontable = actions.LiteLLM_ObjectPermissionTableActions[models.LiteLLM_ObjectPermissionTable](self, models.LiteLLM_ObjectPermissionTable)
        self.litellm_mcpservertable = actions.LiteLLM_MCPServerTableActions[models.LiteLLM_MCPServerTable](self, models.LiteLLM_MCPServerTable)
        self.litellm_verificationtoken = actions.LiteLLM_VerificationTokenActions[models.LiteLLM_VerificationToken](self, models.LiteLLM_VerificationToken)
        self.litellm_endusertable = actions.LiteLLM_EndUserTableActions[models.LiteLLM_EndUserTable](self, models.LiteLLM_EndUserTable)
        self.litellm_config = actions.LiteLLM_ConfigActions[models.LiteLLM_Config](self, models.LiteLLM_Config)
        self.litellm_spendlogs = actions.LiteLLM_SpendLogsActions[models.LiteLLM_SpendLogs](self, models.LiteLLM_SpendLogs)
        self.litellm_errorlogs = actions.LiteLLM_ErrorLogsActions[models.LiteLLM_ErrorLogs](self, models.LiteLLM_ErrorLogs)
        self.litellm_usernotifications = actions.LiteLLM_UserNotificationsActions[models.LiteLLM_UserNotifications](self, models.LiteLLM_UserNotifications)
        self.litellm_teammembership = actions.LiteLLM_TeamMembershipActions[models.LiteLLM_TeamMembership](self, models.LiteLLM_TeamMembership)
        self.litellm_organizationmembership = actions.LiteLLM_OrganizationMembershipActions[models.LiteLLM_OrganizationMembership](self, models.LiteLLM_OrganizationMembership)
        self.litellm_invitationlink = actions.LiteLLM_InvitationLinkActions[models.LiteLLM_InvitationLink](self, models.LiteLLM_InvitationLink)
        self.litellm_auditlog = actions.LiteLLM_AuditLogActions[models.LiteLLM_AuditLog](self, models.LiteLLM_AuditLog)
        self.litellm_dailyuserspend = actions.LiteLLM_DailyUserSpendActions[models.LiteLLM_DailyUserSpend](self, models.LiteLLM_DailyUserSpend)
        self.litellm_dailyteamspend = actions.LiteLLM_DailyTeamSpendActions[models.LiteLLM_DailyTeamSpend](self, models.LiteLLM_DailyTeamSpend)
        self.litellm_dailytagspend = actions.LiteLLM_DailyTagSpendActions[models.LiteLLM_DailyTagSpend](self, models.LiteLLM_DailyTagSpend)
        self.litellm_cronjob = actions.LiteLLM_CronJobActions[models.LiteLLM_CronJob](self, models.LiteLLM_CronJob)
        self.litellm_managedfiletable = actions.LiteLLM_ManagedFileTableActions[models.LiteLLM_ManagedFileTable](self, models.LiteLLM_ManagedFileTable)
        self.litellm_managedobjecttable = actions.LiteLLM_ManagedObjectTableActions[models.LiteLLM_ManagedObjectTable](self, models.LiteLLM_ManagedObjectTable)
        self.litellm_managedvectorstorestable = actions.LiteLLM_ManagedVectorStoresTableActions[models.LiteLLM_ManagedVectorStoresTable](self, models.LiteLLM_ManagedVectorStoresTable)
        self.litellm_guardrailstable = actions.LiteLLM_GuardrailsTableActions[models.LiteLLM_GuardrailsTable](self, models.LiteLLM_GuardrailsTable)
        self.litellm_prompttable = actions.LiteLLM_PromptTableActions[models.LiteLLM_PromptTable](self, models.LiteLLM_PromptTable)
        self.litellm_healthchecktable = actions.LiteLLM_HealthCheckTableActions[models.LiteLLM_HealthCheckTable](self, models.LiteLLM_HealthCheckTable)

        # NOTE: if you add any more properties here then you may also need to forward
        # them in the `_copy()` method.
        self.__engine: Optional[AbstractEngine] = None
        self._active_provider = 'postgresql'
        self._log_queries = log_queries
        self._datasource = datasource

        if isinstance(connect_timeout, int):
            message = (
                'Passing an int as `connect_timeout` argument is deprecated '
                'and will be removed in the next major release. '
                'Use a `datetime.timedelta` instance instead.'
            )
            warnings.warn(message, DeprecationWarning, stacklevel=2)
            connect_timeout = timedelta(seconds=connect_timeout)

        self._connect_timeout = connect_timeout
        self._http_config: HttpConfig = http or {}
        self._tx_id: Optional[TransactionId] = None
        self.__copied: bool = False

        if use_dotenv:
            load_env()

        if auto_register:
            register(self)

    def __del__(self) -> None:
        # Note: as the transaction manager holds a reference to the original
        # client as well as the transaction client the original client cannot
        # be `free`d before the transaction is finished. So stopping the engine
        # here should be safe.
        if self.__engine is not None and not self.__copied:
            log.debug('unclosed client - stopping engine')
            engine = self.__engine
            self.__engine = None
            engine.stop()

    async def __aenter__(self) -> 'Prisma':
        await self.connect()
        return self

    async def __aexit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> None:
        if self.is_connected():
            await self.disconnect()

    def is_registered(self) -> bool:
        """Returns True if this client instance is registered"""
        try:
            return get_client() is self
        except errors.ClientNotRegisteredError:
            return False

    def is_connected(self) -> bool:
        """Returns True if the client is connected to the query engine, False otherwise."""
        return self.__engine is not None

    async def connect(
        self,
        timeout: Union[int, timedelta, UseClientDefault] = _USE_CLIENT_DEFAULT,
    ) -> None:
        """Connect to the Prisma query engine.

        It is required to call this before accessing data.
        """
        if isinstance(timeout, UseClientDefault):
            timeout = self._connect_timeout

        if isinstance(timeout, int):
            message = (
                'Passing an int as `timeout` argument is deprecated '
                'and will be removed in the next major release. '
                'Use a `datetime.timedelta` instance instead.'
            )
            warnings.warn(message, DeprecationWarning, stacklevel=2)
            timeout = timedelta(seconds=timeout)

        if self.__engine is None:
            self.__engine = self._create_engine(dml_path=PACKAGED_SCHEMA_PATH)

        datasources: Optional[List[types.DatasourceOverride]] = None
        if self._datasource is not None:
            ds = self._datasource.copy()
            ds.setdefault('name', 'client')
            datasources = [ds]

        await self.__engine.connect(
            timeout=timeout,
            datasources=datasources,
        )

    async def disconnect(self, timeout: Union[float, timedelta, None] = None) -> None:
        """Disconnect the Prisma query engine."""
        if self.__engine is not None:
            engine = self.__engine
            self.__engine = None
            if isinstance(timeout, float):
                message = (
                    'Passing a float as `timeout` argument is deprecated '
                    'and will be removed in the next major release. '
                    'Use a `datetime.timedelta` instead.'
                )
                warnings.warn(message, DeprecationWarning, stacklevel=2)
                timeout = timedelta(seconds=timeout)
            await engine.aclose(timeout=timeout)
            engine.stop(timeout=timeout)

    async def execute_raw(self, query: LiteralString, *args: Any) -> int:
        resp = await self._execute(
            method='execute_raw',
            arguments={
                'query': query,
                'parameters': args,
            },
            model=None,
        )
        return int(resp['data']['result'])

    @overload
    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
    ) -> dict[str, Any]:
        ...

    @overload
    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
        model: Type[BaseModelT],
    ) -> Optional[BaseModelT]:
        ...

    async def query_first(
        self,
        query: LiteralString,
        *args: Any,
        model: Optional[Type[BaseModelT]] = None,
    ) -> Union[Optional[BaseModelT], dict[str, Any]]:
        """This function is the exact same as `query_raw()` but returns the first result.

        If model is given, the returned record is converted to the pydantic model first,
        otherwise a raw dictionary will be returned.
        """
        results: Sequence[Union[BaseModelT, dict[str, Any]]]
        if model is not None:
            results = await self.query_raw(query, *args, model=model)
        else:
            results = await self.query_raw(query, *args)

        if not results:
            return None

        return results[0]

    @overload
    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
    ) -> List[dict[str, Any]]:
        ...

    @overload
    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
        model: Type[BaseModelT],
    ) -> List[BaseModelT]:
        ...

    async def query_raw(
        self,
        query: LiteralString,
        *args: Any,
        model: Optional[Type[BaseModelT]] = None,
    ) -> Union[List[BaseModelT], List[dict[str, Any]]]:
        """Execute a raw SQL query against the database.

        If model is given, each returned record is converted to the pydantic model first,
        otherwise results will be raw dictionaries.
        """
        resp = await self._execute(
            method='query_raw',
            arguments={
                'query': query,
                'parameters': args,
            },
            model=model,
        )
        result = resp['data']['result']
        if model is not None:
            return deserialize_raw_results(result, model=model)

        return deserialize_raw_results(result)

    def batch_(self) -> 'Batch':
        """Returns a context manager for grouping write queries into a single transaction."""
        return Batch(client=self)

    def tx(
        self,
        *,
        max_wait: Union[int, timedelta] = DEFAULT_TX_MAX_WAIT,
        timeout: Union[int, timedelta] = DEFAULT_TX_TIMEOUT,
    ) -> 'TransactionManager':
        """Returns a context manager for executing queries within a database transaction.

        Entering the context manager returns a new Prisma instance wrapping all
        actions within a transaction, queries will be isolated to the Prisma instance and
        will not be commited to the database until the context manager exits.

        By default, Prisma will wait a maximum of 2 seconds to acquire a transaction from the database. You can modify this
        default with the `max_wait` argument which accepts a value in milliseconds or `datetime.timedelta`.

        By default, Prisma will cancel and rollback ay transactions that last longer than 5 seconds. You can modify this timeout
        with the `timeout` argument which accepts a value in milliseconds or `datetime.timedelta`.

        Example usage:

        ```py
        async with client.tx() as transaction:
            user1 = await client.user.create({'name': 'Robert'})
            user2 = await client.user.create({'name': 'Tegan'})
        ```

        In the above example, if the first database call succeeds but the second does not then neither of the records will be created.
        """
        return TransactionManager(client=self, max_wait=max_wait, timeout=timeout)

    def is_transaction(self) -> bool:
        """Returns True if the client is wrapped within a transaction"""
        return self._tx_id is not None

    @overload
    async def get_metrics(
        self,
        format: Literal['json'] = 'json',
        *,
        global_labels: dict[str, str] | None = None,
    ) -> Metrics:
        ...

    @overload
    async def get_metrics(
        self,
        format: Literal['prometheus'],
        *,
        global_labels: dict[str, str] | None = None,
    ) -> str:
        ...

    async def get_metrics(
        self,
        format: MetricsFormat = 'json',
        *,
        global_labels: dict[str, str] | None = None,
    ) -> str | Metrics:
        """Metrics give you a detailed insight into how the Prisma Client interacts with your database.

        You can retrieve metrics in either JSON or Prometheus formats.

        For more details see https://www.prisma.io/docs/concepts/components/prisma-client/metrics.
        """
        response = await self._engine.metrics(format=format, global_labels=global_labels)
        if format == 'prometheus':
            # For the prometheus format we return the response as-is
            assert isinstance(response, str)
            return response

        return model_parse(Metrics, response)

    # TODO: don't return Any
    async def _execute(
        self,
        method: PrismaMethod,
        arguments: dict[str, Any],
        model: type[BaseModel] | None = None,
        root_selection: list[str] | None = None
    ) -> Any:
        builder = QueryBuilder(
            method=method,
            model=model,
            arguments=arguments,
            root_selection=root_selection,
        )
        return await self._engine.query(builder.build(), tx_id=self._tx_id)

    def _copy(self) -> 'Prisma':
        """Return a new Prisma instance using the same engine process (if connected).

        This is only intended for private usage, there are no guarantees around this API.
        """
        new = Prisma(
            use_dotenv=False,
            http=self._http_config,
            datasource=self._datasource,
            log_queries=self._log_queries,
            connect_timeout=self._connect_timeout,
        )
        new.__copied = True

        if self.__engine is not None:
            new._engine = self.__engine

        return new

    def _create_engine(self, dml_path: Path = PACKAGED_SCHEMA_PATH) -> AbstractEngine:
        if ENGINE_TYPE == EngineType.binary:
            return QueryEngine(dml_path=dml_path, log_queries=self._log_queries, **self._http_config)

        raise NotImplementedError(f'Unsupported engine type: {ENGINE_TYPE}')

    @property
    def _engine_class(self) -> Type[AbstractEngine]:
        if ENGINE_TYPE == EngineType.binary:
            return QueryEngine
        else:  # pragma: no cover
            raise RuntimeError(f'Unhandled engine type: {ENGINE_TYPE}')

    @property
    def _engine(self) -> AbstractEngine:
        engine = self.__engine
        if engine is None:
            raise errors.ClientNotConnectedError()
        return engine

    @_engine.setter
    def _engine(self, engine: AbstractEngine) -> None:
        self.__engine = engine

    def _make_sqlite_datasource(self) -> DatasourceOverride:
        return {
            'name': 'client',
            'url': self._make_sqlite_url(self._default_datasource['url']),
        }

    def _make_sqlite_url(self, url: str, *, relative_to: Path = SCHEMA_PATH.parent) -> str:
        url_path = removeprefix(removeprefix(url, 'file:'), 'sqlite:')
        if url_path == url:
            return url

        if Path(url_path).is_absolute():
            return url

        return f'file:{relative_to.joinpath(url_path).resolve()}'

    @property
    def _default_datasource(self) -> DatasourceOverride:
        return {
            'name': 'client',
            'url': OptionalValueFromEnvVar(**{'value': None, 'fromEnvVar': 'DATABASE_URL'}).resolve(),
        }


class TransactionManager:
    """Context manager for wrapping a Prisma instance within a transaction.

    This should never be created manually, instead it should be used
    through the Prisma.tx() method.
    """

    def __init__(self, *, client: Prisma, max_wait: Union[int, timedelta], timeout: Union[int, timedelta]) -> None:
        self.__client = client

        if isinstance(max_wait, int):
            message = (
                'Passing an int as `max_wait` argument is deprecated '
                'and will be removed in the next major release. '
                'Use a `datetime.timedelta` instance instead.'
            )
            warnings.warn(message, DeprecationWarning, stacklevel=3)
            max_wait = timedelta(milliseconds=max_wait)

        self._max_wait = max_wait

        if isinstance(timeout, int):
            message = (
                'Passing an int as `timeout` argument is deprecated '
                'and will be removed in the next major release. '
                'Use a `datetime.timedelta` instance instead.'
            )
            warnings.warn(message, DeprecationWarning, stacklevel=3)
            timeout = timedelta(milliseconds=timeout)

        self._timeout = timeout

        self._tx_id: Optional[TransactionId] = None

    async def start(self, *, _from_context: bool = False) -> Prisma:
        """Start the transaction and return the wrapped Prisma instance"""
        if self.__client.is_transaction():
            # if we were called from the context manager then the stacklevel
            # needs to be one higher to warn on the actual offending code
            warnings.warn(
                'The current client is already in a transaction. This can lead to surprising behaviour.',
                UserWarning,
                stacklevel=3 if _from_context else 2
            )

        tx_id = await self.__client._engine.start_transaction(
            content=dumps(
                {
                    'timeout': int(self._timeout.total_seconds() * 1000),
                    'max_wait': int(self._max_wait.total_seconds() * 1000),
                }
            ),
        )
        self._tx_id = tx_id
        client = self.__client._copy()
        client._tx_id = tx_id
        return client

    async def commit(self) -> None:
        """Commit the transaction to the database, this transaction will no longer be usable"""
        if self._tx_id is None:
            raise errors.TransactionNotStartedError()

        await self.__client._engine.commit_transaction(self._tx_id)

    async def rollback(self) -> None:
        """Do not commit the changes to the database, this transaction will no longer be usable"""
        if self._tx_id is None:
            raise errors.TransactionNotStartedError()

        await self.__client._engine.rollback_transaction(self._tx_id)

    async def __aenter__(self) -> Prisma:
        return await self.start(_from_context=True)

    async def __aexit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> None:
        if exc is None:
            log.debug('Transaction exited with no exception - commiting')
            await self.commit()
            return

        log.debug('Transaction exited with exc type: %s - rolling back', exc_type)

        try:
            await self.rollback()
        except Exception as exc:
            log.warning(
                'Encountered exc `%s` while rolling back a transaction. Ignoring and raising original exception',
                exc
            )


# TODO: this should return the results as well
# TODO: don't require copy-pasting arguments between actions and batch actions
class Batch:
    litellm_budgettable: 'LiteLLM_BudgetTableBatchActions'
    litellm_credentialstable: 'LiteLLM_CredentialsTableBatchActions'
    litellm_proxymodeltable: 'LiteLLM_ProxyModelTableBatchActions'
    litellm_organizationtable: 'LiteLLM_OrganizationTableBatchActions'
    litellm_modeltable: 'LiteLLM_ModelTableBatchActions'
    litellm_teamtable: 'LiteLLM_TeamTableBatchActions'
    litellm_usertable: 'LiteLLM_UserTableBatchActions'
    litellm_objectpermissiontable: 'LiteLLM_ObjectPermissionTableBatchActions'
    litellm_mcpservertable: 'LiteLLM_MCPServerTableBatchActions'
    litellm_verificationtoken: 'LiteLLM_VerificationTokenBatchActions'
    litellm_endusertable: 'LiteLLM_EndUserTableBatchActions'
    litellm_config: 'LiteLLM_ConfigBatchActions'
    litellm_spendlogs: 'LiteLLM_SpendLogsBatchActions'
    litellm_errorlogs: 'LiteLLM_ErrorLogsBatchActions'
    litellm_usernotifications: 'LiteLLM_UserNotificationsBatchActions'
    litellm_teammembership: 'LiteLLM_TeamMembershipBatchActions'
    litellm_organizationmembership: 'LiteLLM_OrganizationMembershipBatchActions'
    litellm_invitationlink: 'LiteLLM_InvitationLinkBatchActions'
    litellm_auditlog: 'LiteLLM_AuditLogBatchActions'
    litellm_dailyuserspend: 'LiteLLM_DailyUserSpendBatchActions'
    litellm_dailyteamspend: 'LiteLLM_DailyTeamSpendBatchActions'
    litellm_dailytagspend: 'LiteLLM_DailyTagSpendBatchActions'
    litellm_cronjob: 'LiteLLM_CronJobBatchActions'
    litellm_managedfiletable: 'LiteLLM_ManagedFileTableBatchActions'
    litellm_managedobjecttable: 'LiteLLM_ManagedObjectTableBatchActions'
    litellm_managedvectorstorestable: 'LiteLLM_ManagedVectorStoresTableBatchActions'
    litellm_guardrailstable: 'LiteLLM_GuardrailsTableBatchActions'
    litellm_prompttable: 'LiteLLM_PromptTableBatchActions'
    litellm_healthchecktable: 'LiteLLM_HealthCheckTableBatchActions'

    def __init__(self, client: Prisma) -> None:
        self.__client = client
        self.__queries: List[str] = []
        self._active_provider = client._active_provider
        self.litellm_budgettable = LiteLLM_BudgetTableBatchActions(self)
        self.litellm_credentialstable = LiteLLM_CredentialsTableBatchActions(self)
        self.litellm_proxymodeltable = LiteLLM_ProxyModelTableBatchActions(self)
        self.litellm_organizationtable = LiteLLM_OrganizationTableBatchActions(self)
        self.litellm_modeltable = LiteLLM_ModelTableBatchActions(self)
        self.litellm_teamtable = LiteLLM_TeamTableBatchActions(self)
        self.litellm_usertable = LiteLLM_UserTableBatchActions(self)
        self.litellm_objectpermissiontable = LiteLLM_ObjectPermissionTableBatchActions(self)
        self.litellm_mcpservertable = LiteLLM_MCPServerTableBatchActions(self)
        self.litellm_verificationtoken = LiteLLM_VerificationTokenBatchActions(self)
        self.litellm_endusertable = LiteLLM_EndUserTableBatchActions(self)
        self.litellm_config = LiteLLM_ConfigBatchActions(self)
        self.litellm_spendlogs = LiteLLM_SpendLogsBatchActions(self)
        self.litellm_errorlogs = LiteLLM_ErrorLogsBatchActions(self)
        self.litellm_usernotifications = LiteLLM_UserNotificationsBatchActions(self)
        self.litellm_teammembership = LiteLLM_TeamMembershipBatchActions(self)
        self.litellm_organizationmembership = LiteLLM_OrganizationMembershipBatchActions(self)
        self.litellm_invitationlink = LiteLLM_InvitationLinkBatchActions(self)
        self.litellm_auditlog = LiteLLM_AuditLogBatchActions(self)
        self.litellm_dailyuserspend = LiteLLM_DailyUserSpendBatchActions(self)
        self.litellm_dailyteamspend = LiteLLM_DailyTeamSpendBatchActions(self)
        self.litellm_dailytagspend = LiteLLM_DailyTagSpendBatchActions(self)
        self.litellm_cronjob = LiteLLM_CronJobBatchActions(self)
        self.litellm_managedfiletable = LiteLLM_ManagedFileTableBatchActions(self)
        self.litellm_managedobjecttable = LiteLLM_ManagedObjectTableBatchActions(self)
        self.litellm_managedvectorstorestable = LiteLLM_ManagedVectorStoresTableBatchActions(self)
        self.litellm_guardrailstable = LiteLLM_GuardrailsTableBatchActions(self)
        self.litellm_prompttable = LiteLLM_PromptTableBatchActions(self)
        self.litellm_healthchecktable = LiteLLM_HealthCheckTableBatchActions(self)

    def _add(self, **kwargs: Any) -> None:
        builder = QueryBuilder(**kwargs)
        self.__queries.append(builder.build_query())

    async def commit(self) -> None:
        """Execute the queries"""
        # TODO: normalise this, we should still call client._execute
        queries = self.__queries
        self.__queries = []

        payload = {
            'batch': [
                {
                    'query': query,
                    'variables': {},
                }
                for query in queries
            ],
            'transaction': True,
        }
        await self.__client._engine.query(
            dumps(payload),
            tx_id=self.__client._tx_id,
        )

    def execute_raw(self, query: LiteralString, *args: Any) -> None:
        self._add(
            method='execute_raw',
            arguments={
                'query': query,
                'parameters': args,
            }
        )

    async def __aenter__(self) -> 'Batch':
        return self

    async def __aexit__(
        self,
        exc_type: Optional[Type[BaseException]],
        exc: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    ) -> None:
        if exc is None:
            await self.commit()


# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_BudgetTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_BudgetTableCreateInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_BudgetTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_BudgetTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_BudgetTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_BudgetTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_BudgetTableUpdateInput,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_BudgetTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_BudgetTableWhereUniqueInput,
        data: types.LiteLLM_BudgetTableUpsertInput,
        include: Optional[types.LiteLLM_BudgetTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_BudgetTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_BudgetTableUpdateManyMutationInput,
        where: types.LiteLLM_BudgetTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_BudgetTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_BudgetTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_BudgetTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_CredentialsTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_CredentialsTableCreateInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_CredentialsTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_CredentialsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_CredentialsTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_CredentialsTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_CredentialsTableUpdateInput,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_CredentialsTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_CredentialsTableWhereUniqueInput,
        data: types.LiteLLM_CredentialsTableUpsertInput,
        include: Optional[types.LiteLLM_CredentialsTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_CredentialsTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_CredentialsTableUpdateManyMutationInput,
        where: types.LiteLLM_CredentialsTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_CredentialsTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_CredentialsTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_CredentialsTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ProxyModelTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ProxyModelTableCreateInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ProxyModelTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ProxyModelTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ProxyModelTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ProxyModelTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ProxyModelTableUpdateInput,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ProxyModelTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ProxyModelTableWhereUniqueInput,
        data: types.LiteLLM_ProxyModelTableUpsertInput,
        include: Optional[types.LiteLLM_ProxyModelTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ProxyModelTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ProxyModelTableUpdateManyMutationInput,
        where: types.LiteLLM_ProxyModelTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ProxyModelTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ProxyModelTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ProxyModelTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_OrganizationTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_OrganizationTableCreateInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_OrganizationTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_OrganizationTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_OrganizationTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_OrganizationTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_OrganizationTableUpdateInput,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_OrganizationTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_OrganizationTableWhereUniqueInput,
        data: types.LiteLLM_OrganizationTableUpsertInput,
        include: Optional[types.LiteLLM_OrganizationTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_OrganizationTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_OrganizationTableUpdateManyMutationInput,
        where: types.LiteLLM_OrganizationTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_OrganizationTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_OrganizationTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_OrganizationTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ModelTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ModelTableCreateInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ModelTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ModelTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ModelTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ModelTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ModelTableUpdateInput,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ModelTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ModelTableWhereUniqueInput,
        data: types.LiteLLM_ModelTableUpsertInput,
        include: Optional[types.LiteLLM_ModelTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ModelTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ModelTableUpdateManyMutationInput,
        where: types.LiteLLM_ModelTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ModelTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ModelTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ModelTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_TeamTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_TeamTableCreateInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_TeamTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_TeamTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_TeamTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_TeamTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_TeamTableUpdateInput,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_TeamTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_TeamTableWhereUniqueInput,
        data: types.LiteLLM_TeamTableUpsertInput,
        include: Optional[types.LiteLLM_TeamTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_TeamTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_TeamTableUpdateManyMutationInput,
        where: types.LiteLLM_TeamTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_TeamTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_TeamTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_TeamTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_UserTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_UserTableCreateInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_UserTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_UserTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_UserTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_UserTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_UserTableUpdateInput,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_UserTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_UserTableWhereUniqueInput,
        data: types.LiteLLM_UserTableUpsertInput,
        include: Optional[types.LiteLLM_UserTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_UserTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_UserTableUpdateManyMutationInput,
        where: types.LiteLLM_UserTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_UserTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_UserTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_UserTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ObjectPermissionTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ObjectPermissionTableCreateInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ObjectPermissionTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ObjectPermissionTableUpdateInput,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ObjectPermissionTableWhereUniqueInput,
        data: types.LiteLLM_ObjectPermissionTableUpsertInput,
        include: Optional[types.LiteLLM_ObjectPermissionTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ObjectPermissionTableUpdateManyMutationInput,
        where: types.LiteLLM_ObjectPermissionTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ObjectPermissionTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ObjectPermissionTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_MCPServerTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_MCPServerTableCreateInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_MCPServerTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_MCPServerTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_MCPServerTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_MCPServerTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_MCPServerTableUpdateInput,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_MCPServerTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_MCPServerTableWhereUniqueInput,
        data: types.LiteLLM_MCPServerTableUpsertInput,
        include: Optional[types.LiteLLM_MCPServerTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_MCPServerTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_MCPServerTableUpdateManyMutationInput,
        where: types.LiteLLM_MCPServerTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_MCPServerTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_MCPServerTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_MCPServerTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_VerificationTokenBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_VerificationTokenCreateInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_VerificationToken,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_VerificationTokenCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_VerificationToken,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_VerificationToken,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_VerificationTokenUpdateInput,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_VerificationToken,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_VerificationTokenWhereUniqueInput,
        data: types.LiteLLM_VerificationTokenUpsertInput,
        include: Optional[types.LiteLLM_VerificationTokenInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_VerificationToken,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_VerificationTokenUpdateManyMutationInput,
        where: types.LiteLLM_VerificationTokenWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_VerificationToken,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_VerificationTokenWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_VerificationToken,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_EndUserTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_EndUserTableCreateInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_EndUserTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_EndUserTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_EndUserTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_EndUserTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_EndUserTableUpdateInput,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_EndUserTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_EndUserTableWhereUniqueInput,
        data: types.LiteLLM_EndUserTableUpsertInput,
        include: Optional[types.LiteLLM_EndUserTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_EndUserTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_EndUserTableUpdateManyMutationInput,
        where: types.LiteLLM_EndUserTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_EndUserTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_EndUserTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_EndUserTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ConfigBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ConfigCreateInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_Config,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ConfigCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_Config,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_Config,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ConfigUpdateInput,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_Config,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ConfigWhereUniqueInput,
        data: types.LiteLLM_ConfigUpsertInput,
        include: Optional[types.LiteLLM_ConfigInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_Config,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ConfigUpdateManyMutationInput,
        where: types.LiteLLM_ConfigWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_Config,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ConfigWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_Config,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_SpendLogsBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_SpendLogsCreateInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_SpendLogs,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_SpendLogsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_SpendLogs,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_SpendLogs,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_SpendLogsUpdateInput,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_SpendLogs,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_SpendLogsWhereUniqueInput,
        data: types.LiteLLM_SpendLogsUpsertInput,
        include: Optional[types.LiteLLM_SpendLogsInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_SpendLogs,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_SpendLogsUpdateManyMutationInput,
        where: types.LiteLLM_SpendLogsWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_SpendLogs,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_SpendLogsWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_SpendLogs,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ErrorLogsBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ErrorLogsCreateInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ErrorLogs,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ErrorLogsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ErrorLogs,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ErrorLogs,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ErrorLogsUpdateInput,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ErrorLogs,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ErrorLogsWhereUniqueInput,
        data: types.LiteLLM_ErrorLogsUpsertInput,
        include: Optional[types.LiteLLM_ErrorLogsInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ErrorLogs,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ErrorLogsUpdateManyMutationInput,
        where: types.LiteLLM_ErrorLogsWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ErrorLogs,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ErrorLogsWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ErrorLogs,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_UserNotificationsBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_UserNotificationsCreateInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_UserNotifications,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_UserNotificationsCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_UserNotifications,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_UserNotifications,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_UserNotificationsUpdateInput,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_UserNotifications,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_UserNotificationsWhereUniqueInput,
        data: types.LiteLLM_UserNotificationsUpsertInput,
        include: Optional[types.LiteLLM_UserNotificationsInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_UserNotifications,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_UserNotificationsUpdateManyMutationInput,
        where: types.LiteLLM_UserNotificationsWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_UserNotifications,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_UserNotificationsWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_UserNotifications,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_TeamMembershipBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_TeamMembershipCreateInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_TeamMembership,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_TeamMembershipCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_TeamMembership,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_TeamMembership,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_TeamMembershipUpdateInput,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_TeamMembership,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_TeamMembershipWhereUniqueInput,
        data: types.LiteLLM_TeamMembershipUpsertInput,
        include: Optional[types.LiteLLM_TeamMembershipInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_TeamMembership,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_TeamMembershipUpdateManyMutationInput,
        where: types.LiteLLM_TeamMembershipWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_TeamMembership,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_TeamMembershipWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_TeamMembership,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_OrganizationMembershipBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_OrganizationMembershipCreateInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_OrganizationMembership,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_OrganizationMembershipCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_OrganizationMembership,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_OrganizationMembership,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_OrganizationMembershipUpdateInput,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_OrganizationMembership,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_OrganizationMembershipWhereUniqueInput,
        data: types.LiteLLM_OrganizationMembershipUpsertInput,
        include: Optional[types.LiteLLM_OrganizationMembershipInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_OrganizationMembership,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_OrganizationMembershipUpdateManyMutationInput,
        where: types.LiteLLM_OrganizationMembershipWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_OrganizationMembership,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_OrganizationMembershipWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_OrganizationMembership,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_InvitationLinkBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_InvitationLinkCreateInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_InvitationLink,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_InvitationLinkCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_InvitationLink,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_InvitationLink,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_InvitationLinkUpdateInput,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_InvitationLink,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_InvitationLinkWhereUniqueInput,
        data: types.LiteLLM_InvitationLinkUpsertInput,
        include: Optional[types.LiteLLM_InvitationLinkInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_InvitationLink,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_InvitationLinkUpdateManyMutationInput,
        where: types.LiteLLM_InvitationLinkWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_InvitationLink,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_InvitationLinkWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_InvitationLink,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_AuditLogBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_AuditLogCreateInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_AuditLog,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_AuditLogCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_AuditLog,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_AuditLog,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_AuditLogUpdateInput,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_AuditLog,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_AuditLogWhereUniqueInput,
        data: types.LiteLLM_AuditLogUpsertInput,
        include: Optional[types.LiteLLM_AuditLogInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_AuditLog,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_AuditLogUpdateManyMutationInput,
        where: types.LiteLLM_AuditLogWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_AuditLog,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_AuditLogWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_AuditLog,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_DailyUserSpendBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_DailyUserSpendCreateInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_DailyUserSpend,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_DailyUserSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_DailyUserSpend,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_DailyUserSpend,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_DailyUserSpendUpdateInput,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_DailyUserSpend,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_DailyUserSpendWhereUniqueInput,
        data: types.LiteLLM_DailyUserSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyUserSpendInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_DailyUserSpend,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_DailyUserSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyUserSpendWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_DailyUserSpend,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyUserSpendWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_DailyUserSpend,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_DailyTeamSpendBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_DailyTeamSpendCreateInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_DailyTeamSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_DailyTeamSpendUpdateInput,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_DailyTeamSpendWhereUniqueInput,
        data: types.LiteLLM_DailyTeamSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyTeamSpendInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_DailyTeamSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyTeamSpendWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyTeamSpendWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_DailyTeamSpend,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_DailyTagSpendBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_DailyTagSpendCreateInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_DailyTagSpend,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_DailyTagSpendCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_DailyTagSpend,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_DailyTagSpend,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_DailyTagSpendUpdateInput,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_DailyTagSpend,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_DailyTagSpendWhereUniqueInput,
        data: types.LiteLLM_DailyTagSpendUpsertInput,
        include: Optional[types.LiteLLM_DailyTagSpendInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_DailyTagSpend,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_DailyTagSpendUpdateManyMutationInput,
        where: types.LiteLLM_DailyTagSpendWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_DailyTagSpend,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_DailyTagSpendWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_DailyTagSpend,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_CronJobBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_CronJobCreateInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_CronJob,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_CronJobCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_CronJob,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_CronJob,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_CronJobUpdateInput,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_CronJob,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_CronJobWhereUniqueInput,
        data: types.LiteLLM_CronJobUpsertInput,
        include: Optional[types.LiteLLM_CronJobInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_CronJob,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_CronJobUpdateManyMutationInput,
        where: types.LiteLLM_CronJobWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_CronJob,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_CronJobWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_CronJob,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ManagedFileTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ManagedFileTableCreateInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ManagedFileTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ManagedFileTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ManagedFileTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ManagedFileTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ManagedFileTableUpdateInput,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ManagedFileTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ManagedFileTableWhereUniqueInput,
        data: types.LiteLLM_ManagedFileTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedFileTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ManagedFileTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ManagedFileTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedFileTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ManagedFileTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedFileTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ManagedFileTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ManagedObjectTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ManagedObjectTableCreateInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ManagedObjectTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ManagedObjectTableUpdateInput,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ManagedObjectTableWhereUniqueInput,
        data: types.LiteLLM_ManagedObjectTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedObjectTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ManagedObjectTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedObjectTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedObjectTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ManagedObjectTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_ManagedVectorStoresTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_ManagedVectorStoresTableCreateInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_ManagedVectorStoresTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_ManagedVectorStoresTableUpdateInput,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_ManagedVectorStoresTableWhereUniqueInput,
        data: types.LiteLLM_ManagedVectorStoresTableUpsertInput,
        include: Optional[types.LiteLLM_ManagedVectorStoresTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_ManagedVectorStoresTableUpdateManyMutationInput,
        where: types.LiteLLM_ManagedVectorStoresTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_ManagedVectorStoresTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_ManagedVectorStoresTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_GuardrailsTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_GuardrailsTableCreateInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_GuardrailsTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_GuardrailsTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_GuardrailsTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_GuardrailsTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_GuardrailsTableUpdateInput,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_GuardrailsTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_GuardrailsTableWhereUniqueInput,
        data: types.LiteLLM_GuardrailsTableUpsertInput,
        include: Optional[types.LiteLLM_GuardrailsTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_GuardrailsTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_GuardrailsTableUpdateManyMutationInput,
        where: types.LiteLLM_GuardrailsTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_GuardrailsTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_GuardrailsTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_GuardrailsTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_PromptTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_PromptTableCreateInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_PromptTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_PromptTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_PromptTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_PromptTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_PromptTableUpdateInput,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_PromptTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_PromptTableWhereUniqueInput,
        data: types.LiteLLM_PromptTableUpsertInput,
        include: Optional[types.LiteLLM_PromptTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_PromptTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_PromptTableUpdateManyMutationInput,
        where: types.LiteLLM_PromptTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_PromptTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_PromptTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_PromptTable,
            arguments={'where': where},
            root_selection=['count'],
        )



# NOTE: some arguments are meaningless in this context but are included
# for completeness sake
class LiteLLM_HealthCheckTableBatchActions:
    def __init__(self, batcher: Batch) -> None:
        self._batcher = batcher

    def create(
        self,
        data: types.LiteLLM_HealthCheckTableCreateInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='create',
            model=models.LiteLLM_HealthCheckTable,
            arguments={
                'data': data,
                'include': include,
            },
        )

    def create_many(
        self,
        data: List[types.LiteLLM_HealthCheckTableCreateWithoutRelationsInput],
        *,
        skip_duplicates: Optional[bool] = None,
    ) -> None:
        if self._batcher._active_provider == 'sqlite':
            raise errors.UnsupportedDatabaseError('sqlite', 'create_many()')

        self._batcher._add(
            method='create_many',
            model=models.LiteLLM_HealthCheckTable,
            arguments={
                'data': data,
                'skipDuplicates': skip_duplicates,
            },
            root_selection=['count'],
        )

    def delete(
        self,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='delete',
            model=models.LiteLLM_HealthCheckTable,
            arguments={
                'where': where,
                'include': include,
            },
        )

    def update(
        self,
        data: types.LiteLLM_HealthCheckTableUpdateInput,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None
    ) -> None:
        self._batcher._add(
            method='update',
            model=models.LiteLLM_HealthCheckTable,
            arguments={
                'data': data,
                'where': where,
                'include': include,
            },
        )

    def upsert(
        self,
        where: types.LiteLLM_HealthCheckTableWhereUniqueInput,
        data: types.LiteLLM_HealthCheckTableUpsertInput,
        include: Optional[types.LiteLLM_HealthCheckTableInclude] = None,
    ) -> None:
        self._batcher._add(
            method='upsert',
            model=models.LiteLLM_HealthCheckTable,
            arguments={
                'where': where,
                'include': include,
                'create': data.get('create'),
                'update': data.get('update'),
            },
        )

    def update_many(
        self,
        data: types.LiteLLM_HealthCheckTableUpdateManyMutationInput,
        where: types.LiteLLM_HealthCheckTableWhereInput,
    ) -> None:
        self._batcher._add(
            method='update_many',
            model=models.LiteLLM_HealthCheckTable,
            arguments={'data': data, 'where': where,},
            root_selection=['count'],
        )

    def delete_many(
        self,
        where: Optional[types.LiteLLM_HealthCheckTableWhereInput] = None,
    ) -> None:
        self._batcher._add(
            method='delete_many',
            model=models.LiteLLM_HealthCheckTable,
            arguments={'where': where},
            root_selection=['count'],
        )



Client = Prisma