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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .provider_api_key_provider import ProviderApiKeyProvider


class ProviderApiKey(UniversalBaseModel):
    id: typing.Optional[str] = None
    provider: ProviderApiKeyProvider
    api_key: typing.Optional[str] = None
    name: typing.Optional[str] = None
    provider_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Provider name - required for custom LLM and Bedrock providers to uniquely identify them (e.g., 'ollama', 'vllm', 'Bedrock us-east-1'). Must not be blank for custom and Bedrock providers. Should not be set for standard providers (OpenAI, Anthropic, etc.). This requirement is conditional and validation is enforced programmatically.
    """

    headers: typing.Optional[typing.Dict[str, str]] = None
    configuration: typing.Optional[typing.Dict[str, str]] = None
    base_url: typing.Optional[str] = None
    created_at: typing.Optional[dt.datetime] = None
    created_by: typing.Optional[str] = None
    last_updated_at: typing.Optional[dt.datetime] = None
    last_updated_by: typing.Optional[str] = None
    read_only: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If true, this provider is system-managed and cannot be edited or deleted
    """

    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
