# 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
from .quality_status import QualityStatus


class FieldComparison(UniversalBaseModel):
    """
    Comparison of a single field between old and new measurements.
    """

    key: str = pydantic.Field()
    """
    Field name, e.g. 'Breite', 'Hoehe'
    """

    old_value: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="oldValue"),
        pydantic.Field(alias="oldValue", description="Previous value; null if field is new."),
    ] = None
    new_value: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="newValue"),
        pydantic.Field(alias="newValue", description="New value; null if field is missing in new data."),
    ] = None
    status: QualityStatus
    comment: str = pydantic.Field()
    """
    Human-readable note, e.g. '+5mm (innerhalb RF Toleranz)'
    """

    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
