# 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


class UploadRequestCsv(UniversalBaseModel):
    name: str = pydantic.Field()
    """
    Name of the code system. Names are case-insensitive and stored uppercase.
    Builtin system names (e.g. ICD-10-CM, SNOMED_CT_US_LITE, LOINC, CPT, etc.) are
    reserved and cannot be used for custom uploads; attempts return HTTP 403 Forbidden.
    """

    version: str = pydantic.Field()
    """
    Version of the code system
    """

    revision: typing.Optional[float] = pydantic.Field(default=None)
    """
    Optional revision number
    """

    file: str = pydantic.Field()
    """
    The CSV file contents as a base64-encoded string.
    """

    code_col: str = pydantic.Field()
    """
    Column name containing codes
    """

    desc_col: str = pydantic.Field()
    """
    Column name containing descriptions
    """

    defn_col: typing.Optional[str] = pydantic.Field(default=None)
    """
    Optional column name containing long definitions
    """

    replace: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If true, replaces an existing code system with the same name and version.
    Builtin systems cannot be replaced; attempts to do so return HTTP 403 Forbidden.
    When false (default), uploading a duplicate returns 409 Conflict.
    """

    async_: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="async")] = pydantic.Field(
        default=None
    )
    """
    If true, returns 202 Accepted immediately after validation and starts processing
    in the background. Poll GET /construe/codes/systems/{name}?version={version} to
    check when status transitions from "processing" to "ready" or "failed".
    """

    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
