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

import typing

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


class FileGrepResult(UniversalBaseModel):
    """
    Multi-file grep result
    """

    path: str = pydantic.Field()
    """
    Search directory path
    """

    pattern: str = pydantic.Field()
    """
    Search pattern used
    """

    matches: typing.Optional[typing.List[GrepMatch]] = pydantic.Field(default=None)
    """
    List of matches
    """

    match_count: typing.Optional[int] = pydantic.Field(default=None)
    """
    Total number of matches
    """

    files_searched: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of files searched
    """

    files_matched: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of files with matches
    """

    truncated: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether results were truncated
    """

    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
