# 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 .instruction_id import InstructionId
from .instruction_name import InstructionName
from .template_type import TemplateType


class InitialInstruction(UniversalBaseModel):
    """
    An initial instruction that provides guidance to the agent before user messages.
    """

    id: InstructionId
    type: typing.Literal["initial"] = "initial"
    name: InstructionName
    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    A detailed description of what this instruction does.
    """

    template_type: TemplateType = "velocity"
    template: str = pydantic.Field()
    """
    The instruction template content using the specified template engine.
    """

    version: int = pydantic.Field()
    """
    The version identifier for this instruction. This is automatically incremented when the instruction is updated.
    """

    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Arbitrary metadata associated with the instruction.
    """

    enabled: bool = pydantic.Field()
    """
    Whether the instruction is currently enabled and available for use.
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp when the instruction was created.
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp when the instruction was last updated.
    """

    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
