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

from __future__ import annotations

import typing

import typing_extensions
from ..core.serialization import FieldMetadata
from ..types.json_object import JsonObject
from ..types.legacy_classification_config_base_processor import LegacyClassificationConfigBaseProcessor
from ..types.legacy_extraction_config_base_processor import LegacyExtractionConfigBaseProcessor
from ..types.legacy_splitter_config_base_processor import LegacySplitterConfigBaseProcessor
from .legacy_classification import LegacyClassificationParams
from .legacy_classification_advanced_options import LegacyClassificationAdvancedOptionsParams
from .legacy_extraction_advanced_options import LegacyExtractionAdvancedOptionsParams
from .legacy_extraction_field import LegacyExtractionFieldParams
from .legacy_splitter_advanced_options import LegacySplitterAdvancedOptionsParams
from .parse_config import ParseConfigParams


class LegacyProcessorVersionConfig_ClassifyParams(typing_extensions.TypedDict):
    type: typing.Literal["CLASSIFY"]
    base_processor: typing_extensions.NotRequired[
        typing_extensions.Annotated[LegacyClassificationConfigBaseProcessor, FieldMetadata(alias="baseProcessor")]
    ]
    base_version: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="baseVersion")]]
    classifications: typing.Sequence[LegacyClassificationParams]
    classification_rules: typing_extensions.NotRequired[
        typing_extensions.Annotated[str, FieldMetadata(alias="classificationRules")]
    ]
    advanced_options: typing_extensions.NotRequired[
        typing_extensions.Annotated[LegacyClassificationAdvancedOptionsParams, FieldMetadata(alias="advancedOptions")]
    ]
    parser: typing_extensions.NotRequired[ParseConfigParams]


class LegacyProcessorVersionConfig_ExtractParams(typing_extensions.TypedDict):
    type: typing.Literal["EXTRACT"]
    base_processor: typing_extensions.NotRequired[
        typing_extensions.Annotated[LegacyExtractionConfigBaseProcessor, FieldMetadata(alias="baseProcessor")]
    ]
    base_version: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="baseVersion")]]
    extraction_rules: typing_extensions.NotRequired[
        typing_extensions.Annotated[str, FieldMetadata(alias="extractionRules")]
    ]
    schema: typing_extensions.NotRequired[JsonObject]
    fields: typing_extensions.NotRequired[typing.Sequence[LegacyExtractionFieldParams]]
    advanced_options: typing_extensions.NotRequired[
        typing_extensions.Annotated[LegacyExtractionAdvancedOptionsParams, FieldMetadata(alias="advancedOptions")]
    ]
    parser: typing_extensions.NotRequired[ParseConfigParams]


class LegacyProcessorVersionConfig_SplitterParams(typing_extensions.TypedDict):
    type: typing.Literal["SPLITTER"]
    base_processor: typing_extensions.NotRequired[
        typing_extensions.Annotated[LegacySplitterConfigBaseProcessor, FieldMetadata(alias="baseProcessor")]
    ]
    base_version: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="baseVersion")]]
    split_classifications: typing_extensions.Annotated[
        typing.Sequence[LegacyClassificationParams], FieldMetadata(alias="splitClassifications")
    ]
    split_rules: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="splitRules")]]
    advanced_options: typing_extensions.NotRequired[
        typing_extensions.Annotated[LegacySplitterAdvancedOptionsParams, FieldMetadata(alias="advancedOptions")]
    ]
    parser: typing_extensions.NotRequired[ParseConfigParams]


LegacyProcessorVersionConfigParams = typing.Union[
    LegacyProcessorVersionConfig_ClassifyParams,
    LegacyProcessorVersionConfig_ExtractParams,
    LegacyProcessorVersionConfig_SplitterParams,
]
