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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .function_schedule_request_body import FunctionScheduleRequestBody
from .patch_function_request_config_request_body_params import PatchFunctionRequestConfigRequestBodyParams
from .patch_function_request_config_request_body_secrets import PatchFunctionRequestConfigRequestBodySecrets


class PatchFunctionRequestConfigRequestBody(UniversalBaseModel):
    """
    Configuration fields to update on the Function. All fields are optional; only provided fields are updated.
    """

    handler: typing.Optional[str] = pydantic.Field(default=None)
    """
    The handler entrypoint for the function code (e.g. 'index.handler').
    """

    is_schedule_enabled: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="isScheduleEnabled"),
        pydantic.Field(alias="isScheduleEnabled", description="Whether the run schedule is enabled."),
    ] = None
    params: typing.Optional[PatchFunctionRequestConfigRequestBodyParams] = pydantic.Field(default=None)
    """
    Default parameter values for the function. Replaces all existing parameters.
    """

    schedule: typing.Optional[FunctionScheduleRequestBody] = None
    secrets: typing.Optional[PatchFunctionRequestConfigRequestBodySecrets] = pydantic.Field(default=None)
    """
    Secrets available to the function at runtime. Replaces all existing secrets.
    """

    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
