# 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 OtlpBodyValue(UniversalBaseModel):
    """
    OTLP body value for log record messages.

    Unlike OTLPAttributeValue, this class does NOT have max_length constraints
    on stringValue. This allows the OTLPLogRecord.validate_body_size validator
    to handle truncation for messages between 4KB and 64KB, rather than having
    Pydantic reject them outright due to the 4KB attribute limit.

    Messages exceeding MAX_MESSAGE_LENGTH (64KB) are truncated with a marker.
    """

    array_value: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Any]],
        FieldMetadata(alias="arrayValue"),
        pydantic.Field(alias="arrayValue"),
    ] = None
    bool_value: typing_extensions.Annotated[
        typing.Optional[bool], FieldMetadata(alias="boolValue"), pydantic.Field(alias="boolValue")
    ] = None
    bytes_value: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="bytesValue"), pydantic.Field(alias="bytesValue")
    ] = None
    double_value: typing_extensions.Annotated[
        typing.Optional[float], FieldMetadata(alias="doubleValue"), pydantic.Field(alias="doubleValue")
    ] = None
    int_value: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="intValue"), pydantic.Field(alias="intValue")
    ] = None
    string_value: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="stringValue"), pydantic.Field(alias="stringValue")
    ] = None

    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
