# 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, update_forward_refs
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel
from .edit_root_json import EditRootJson
from .edit_schema_generation_mapping_result import EditSchemaGenerationMappingResult


class EditSchemaGenerationResponse(UncheckedBaseModel):
    """
    The generated schema and optional mapping metadata.
    """

    schema_: typing_extensions.Annotated[EditRootJson, FieldMetadata(alias="schema")] = pydantic.Field(alias="schema")
    """
    The final generated schema after mapping. If no input schema was provided this will be the same as the annotatedSchema.
    """

    annotated_schema: typing_extensions.Annotated[
        typing.Optional[EditRootJson], FieldMetadata(alias="annotatedSchema")
    ] = pydantic.Field(alias="annotatedSchema", default=None)
    """
    The original schema that was detected and annotated from the file.
    """

    mapping_result: typing_extensions.Annotated[
        typing.Optional[EditSchemaGenerationMappingResult], FieldMetadata(alias="mappingResult")
    ] = pydantic.Field(alias="mappingResult", default=None)
    """
    Mapping information between `inputSchema` paths and detected form fields when an input schema was provided.
    """

    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(EditSchemaGenerationResponse)
