# 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


class FilesystemFileResponse(UniversalBaseModel):
    """
    File metadata response - adds server-side fields.
    """

    checksum: typing.Optional[str] = pydantic.Field(default=None)
    """
    SHA256 checksum (None for directories).
    """

    content: typing.Optional[str] = pydantic.Field(default=None)
    """
    File contents (None for binary/large files).
    """

    content_truncated: typing.Optional[bool] = pydantic.Field(default=None)
    """
    True if content was truncated due to size.
    """

    is_binary: typing.Optional[bool] = pydantic.Field(default=None)
    """
    True if file is binary.
    """

    is_directory: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether this entry is a directory.
    """

    mime_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    MIME type (None for directories).
    """

    modified_at: dt.datetime = pydantic.Field()
    """
    File's last modification time.
    """

    path: str = pydantic.Field()
    """
    Relative path within filesystem (e.g., 'src/index.ts').
    """

    size_bytes: typing.Optional[int] = pydantic.Field(default=None)
    """
    File size in bytes (None for directories).
    """

    synced_at: dt.datetime = pydantic.Field()
    """
    When this entry was last synced.
    """

    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
