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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel, update_forward_refs
from ..core.serialization import FieldMetadata
from .big_query_table_reference import BigQueryTableReference
from .big_query_table_schema import BigQueryTableSchema


class BigQueryTable(UniversalBaseModel):
    """
    BigQuery table object - matches API format
    """

    table_reference: typing_extensions.Annotated[BigQueryTableReference, FieldMetadata(alias="tableReference")] = (
        pydantic.Field()
    )
    """
    Table reference
    """

    schema_: typing_extensions.Annotated[typing.Optional[BigQueryTableSchema], FieldMetadata(alias="schema")] = (
        pydantic.Field(default=None)
    )
    """
    Table schema
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Table description
    """

    num_rows: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="numRows")] = pydantic.Field(
        default=None
    )
    """
    Number of rows
    """

    creation_time: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="creationTime")] = (
        pydantic.Field(default=None)
    )
    """
    Creation timestamp
    """

    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


update_forward_refs(BigQueryTable)
