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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
import typing_extensions
from ..core.serialization import FieldMetadata
from .batch_record_method import BatchRecordMethod
from .redaction_enum_redaction import RedactionEnumRedaction
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class V1BatchRecord(UniversalBaseModel):
    fields: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Field and value key pairs. For example, `{'field_1':'value_1', 'field_2':'value_2'}`. Only valid when `method` is `POST` or `PUT`.
    """

    table_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="tableName")] = pydantic.Field(
        default=None
    )
    """
    Name of the table to perform the operation on.
    """

    method: typing.Optional[BatchRecordMethod] = None
    batch_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="batchID")] = pydantic.Field(
        default=None
    )
    """
    ID to group operations by. Operations in the same group are executed sequentially.
    """

    redaction: typing.Optional[RedactionEnumRedaction] = None
    tokenization: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If `true`, this operation returns tokens for fields with tokenization enabled. Only applicable if `skyflow_id` values are specified.
    """

    id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="ID")] = pydantic.Field(default=None)
    """
    `skyflow_id` for the record. Only valid when `method` is `GET`, `DELETE`, or `PUT`.
    """

    download_url: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="downloadURL")] = (
        pydantic.Field(default=None)
    )
    """
    If `true`, returns download URLs for fields with a file data type. URLs are valid for 15 minutes. If virus scanning is enabled, only returns if the file is clean.
    """

    upsert: typing.Optional[str] = pydantic.Field(default=None)
    """
    Column that stores primary keys for upsert operations. The column must be marked as unique in the vault schema. Only valid when `method` is `POST`.
    """

    tokens: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Fields and tokens for the record. For example, `{'field_1':'token_1', 'field_2':'token_2'}`.
    """

    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
