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

from __future__ import annotations

import typing

import typing_extensions
from ..core.serialization import FieldMetadata
from ..types.block_type import BlockType
from .block_details import BlockDetailsParams
from .block_metadata import BlockMetadataParams
from .block_polygon_item import BlockPolygonItemParams
from .bounding_box import BoundingBoxParams


class BlockParams(typing_extensions.TypedDict):
    object: typing.Literal["block"]
    """
    The type of object. In this case, it will always be `"block"`.
    """

    id: str
    """
    A unique identifier for the block, deterministically generated as a hash of the block content.
    """

    parent_block_id: typing_extensions.NotRequired[
        typing_extensions.Annotated[str, FieldMetadata(alias="parentBlockId")]
    ]
    """
    The ID of the parent block. For example, for a table cell block, this would be the ID of the parent table block. Only set if this is a child block.
    """

    type: BlockType
    """
    The type of block:
    * `"text"` - Regular text content
    * `"heading"` - Section or document headings 
    * `"section_heading"` - Subsection headings
    * `"table"` - Tabular data with rows and columns
    * `"table_head"` - Table header cells
    * `"table_cell"` - Table body cells
    * `"figure"` - Images, charts, diagrams, or logos
    """

    content: str
    """
    The textual content of the block formatted based on the target format.
    """

    details: BlockDetailsParams
    """
    Additional details specific to the block type. The schema depends on the block type.
    """

    metadata: BlockMetadataParams
    """
    Metadata about the block.
    """

    polygon: typing.Sequence[BlockPolygonItemParams]
    """
    An array of points defining the polygon that bounds the block.
    """

    bounding_box: typing_extensions.Annotated[BoundingBoxParams, FieldMetadata(alias="boundingBox")]
    """
    A simplified bounding box for the block.
    """

    children: typing_extensions.NotRequired[typing.Sequence["BlockParams"]]
    """
    An array of child blocks. For example, a table block may contain table cell blocks as children when `cellBlocksEnabled` is set to true.
    """
