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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata


class LogEntry(UniversalBaseModel):
    """
    Cloud Logging log entry - matches API format
    """

    log_name: typing_extensions.Annotated[str, FieldMetadata(alias="logName")] = pydantic.Field()
    """
    Log name
    """

    text_payload: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="textPayload")] = (
        pydantic.Field(default=None)
    )
    """
    Text payload
    """

    json_payload: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="jsonPayload")
    ] = pydantic.Field(default=None)
    """
    JSON payload
    """

    severity: typing.Optional[str] = pydantic.Field(default=None)
    """
    Log severity (DEBUG, INFO, WARNING, ERROR, CRITICAL)
    """

    timestamp: typing.Optional[str] = pydantic.Field(default=None)
    """
    Entry timestamp
    """

    insert_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="insertId")] = pydantic.Field(
        default=None
    )
    """
    Unique insert ID
    """

    resource: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Monitored resource
    """

    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
