# 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 .create_function_request_config_request_body_params import CreateFunctionRequestConfigRequestBodyParams
from .create_function_request_config_request_body_secrets import CreateFunctionRequestConfigRequestBodySecrets
from .function_schedule_request_body import FunctionScheduleRequestBody


class CreateFunctionRequestConfigRequestBody(UniversalBaseModel):
    """
    Configuration for the new Function.
    """

    handler: str = pydantic.Field()
    """
    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[CreateFunctionRequestConfigRequestBodyParams] = pydantic.Field(default=None)
    """
    Default parameter values for the function.
    """

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

    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
