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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
import datetime as dt
from .budget_reset_period_enum import BudgetResetPeriodEnum
from .user_simple import UserSimple
from .provider_enum import ProviderEnum
from .scope_enum import ScopeEnum
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class ModelProviderConnection(UncheckedBaseModel):
    budget_alert_threshold: typing.Optional[float] = pydantic.Field(default=None)
    """
    Budget alert threshold for the given provider connection
    """

    budget_last_reset_date: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Date and time the budget was last reset
    """

    budget_limit: typing.Optional[float] = pydantic.Field(default=None)
    """
    Budget limit for the model provider connection (null if unlimited)
    """

    budget_reset_period: typing.Optional[BudgetResetPeriodEnum] = pydantic.Field(default=None)
    """
    Budget reset period for the model provider connection (null if not reset)
    
    * `Monthly` - Monthly
    * `Yearly` - Yearly
    """

    budget_total_spent: typing.Optional[float] = pydantic.Field(default=None)
    """
    Tracked total budget spent for the given provider connection within the current budget period
    """

    cached_available_models: typing.Optional[str] = pydantic.Field(default=None)
    """
    List of available models from the provider
    """

    created_at: typing.Optional[dt.datetime] = None
    created_by: typing.Optional[UserSimple] = None
    deployment_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Azure OpenAI deployment name
    """

    endpoint: typing.Optional[str] = pydantic.Field(default=None)
    """
    Azure OpenAI endpoint
    """

    google_location: typing.Optional[str] = pydantic.Field(default=None)
    """
    Google project location
    """

    google_project_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Google project ID
    """

    id: typing.Optional[int] = None
    is_internal: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether the model provider connection is internal, not visible to the user
    """

    model_params: typing.Optional[str] = pydantic.Field(default=None)
    """
    JSON schema for the model parameters available for the provider
    """

    organization: typing.Optional[int] = None
    provider: typing.Optional[ProviderEnum] = None
    scope: typing.Optional[ScopeEnum] = None
    updated_at: typing.Optional[dt.datetime] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
