# 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
from .borders_model import BordersModel
from .cell_format_horizontal_alignment import CellFormatHorizontalAlignment
from .cell_format_vertical_alignment import CellFormatVerticalAlignment
from .number_format_model import NumberFormatModel
from .text_format_model import TextFormatModel
from .textrotation import Textrotation
from .theme_color import ThemeColor
from .wrap_strategy import WrapStrategy


class CellFormat(UniversalBaseModel):
    background_color_hex: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="backgroundColor_hex")
    ] = pydantic.Field(default=None)
    """
    Background color as hex string (e.g., '#FF0000'). Use either backgroundColor_hex or backgroundColor_theme, not both.
    """

    background_color_theme: typing_extensions.Annotated[
        typing.Optional[ThemeColor], FieldMetadata(alias="backgroundColor_theme")
    ] = pydantic.Field(default=None)
    """
    Background color as theme reference. Use either backgroundColor_hex or backgroundColor_theme, not both.
    """

    borders: typing.Optional[BordersModel] = None
    horizontal_alignment: typing_extensions.Annotated[
        typing.Optional[CellFormatHorizontalAlignment], FieldMetadata(alias="horizontalAlignment")
    ] = None
    indent: typing.Optional[int] = None
    number_format: typing_extensions.Annotated[
        typing.Optional[NumberFormatModel], FieldMetadata(alias="numberFormat")
    ] = None
    text_format: typing_extensions.Annotated[typing.Optional[TextFormatModel], FieldMetadata(alias="textFormat")] = None
    text_rotation: typing_extensions.Annotated[typing.Optional[Textrotation], FieldMetadata(alias="textRotation")] = (
        None
    )
    vertical_alignment: typing_extensions.Annotated[
        typing.Optional[CellFormatVerticalAlignment], FieldMetadata(alias="verticalAlignment")
    ] = None
    wrap_strategy: typing_extensions.Annotated[typing.Optional[WrapStrategy], FieldMetadata(alias="wrapStrategy")] = (
        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
