# 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 .version_summary import VersionSummary


class BranchResponse(UniversalBaseModel):
    """
    Full branch details including current version.
    """

    agent_id: str = pydantic.Field()
    """
    Parent agent ID
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Creation timestamp
    """

    current_version: typing.Optional[VersionSummary] = pydantic.Field(default=None)
    """
    Currently active version (includes status)
    """

    git_branch: str = pydantic.Field()
    """
    Original git branch name
    """

    git_branch_normalized: str = pydantic.Field()
    """
    DNS-safe branch name
    """

    id: str = pydantic.Field()
    """
    Branch ID
    """

    replicas: int = pydantic.Field()
    """
    Desired replica count
    """

    retired_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When branch was retired
    """

    retired_reason: typing.Optional[str] = pydantic.Field(default=None)
    """
    Reason for retirement
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Last update timestamp
    """

    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
