# 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
from ...core.serialization import FieldMetadata
from .code_response import CodeResponse


class UploadRequest_Csv(UniversalBaseModel):
    format: typing.Literal["csv"] = "csv"
    name: str
    version: str
    revision: typing.Optional[float] = None
    file: str
    code_col: str
    desc_col: str
    defn_col: typing.Optional[str] = None
    replace: typing.Optional[bool] = None
    async_: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="async")] = 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


class UploadRequest_Json(UniversalBaseModel):
    format: typing.Literal["json"] = "json"
    name: str
    version: str
    revision: typing.Optional[float] = None
    file: typing.Optional[str] = None
    codes: typing.Optional[typing.List[CodeResponse]] = None
    replace: typing.Optional[bool] = None
    async_: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="async")] = 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


UploadRequest = typing.Union[UploadRequest_Csv, UploadRequest_Json]
