# 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
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel


class BarcodeDetails(UncheckedBaseModel):
    """
    Details for barcode blocks
    """

    type: typing.Literal["barcode_details"] = pydantic.Field(default="barcode_details")
    """
    Indicates this is a barcode details object
    """

    image_url: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="imageUrl")] = pydantic.Field(
        alias="imageUrl", default=None
    )
    """
    URL to the clipped/segmented barcode image. Only set if the option `imageClippingEnabled` in blockOptions.barcodes is `true`.
    """

    decoded_value: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="decodedValue")] = (
        pydantic.Field(alias="decodedValue", default=None)
    )
    """
    The decoded value of the barcode or QR code. Only set if the option `readingEnabled` in blockOptions.barcodes is `true`.
    """

    format: typing.Optional[str] = pydantic.Field(default=None)
    """
    The format of the barcode (e.g., "QRCode", "Code128", "DataMatrix", "EAN13").
    """

    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
