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

import typing

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


class SandboxHook(UniversalBaseModel):
    """
    A registered lifecycle hook.
    """

    name: str = pydantic.Field()
    """
    Unique name for this hook
    """

    event: typing.Optional[str] = pydantic.Field(default=None)
    """
    Lifecycle event: "shutdown"
    """

    command: str = pydantic.Field()
    """
    Shell command to execute
    """

    timeout: typing.Optional[float] = pydantic.Field(default=None)
    """
    Per-hook timeout in seconds
    """

    priority: typing.Optional[int] = pydantic.Field(default=None)
    """
    Execution priority (lower = earlier). Same priority hooks run in parallel
    """

    source: typing.Optional[str] = pydantic.Field(default=None)
    """
    Registration source: "env" or "api"
    """

    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
