# 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 .v_1_vision_step_results_item_caliper_angle_range import V1VisionStepResultsItemCaliperAngleRange
from .v_1_vision_step_results_item_caliper_contrast_range import V1VisionStepResultsItemCaliperContrastRange
from .v_1_vision_step_results_item_caliper_filter_polarity import V1VisionStepResultsItemCaliperFilterPolarity
from .v_1_vision_step_results_item_caliper_sharpness_range import V1VisionStepResultsItemCaliperSharpnessRange
from .v_1_vision_step_results_item_caliper_straightness_range import V1VisionStepResultsItemCaliperStraightnessRange


class V1VisionStepResultsItemCaliper(UniversalBaseModel):
    angle_range: typing_extensions.Annotated[
        typing.Optional[V1VisionStepResultsItemCaliperAngleRange],
        FieldMetadata(alias="angleRange"),
        pydantic.Field(alias="angleRange", description="The configured angle allowance range"),
    ] = None
    contrast_range: typing_extensions.Annotated[
        typing.Optional[V1VisionStepResultsItemCaliperContrastRange],
        FieldMetadata(alias="contrastRange"),
        pydantic.Field(alias="contrastRange", description="The configured contrast allowance range"),
    ] = None
    distance_found: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="distanceFound"),
        pydantic.Field(alias="distanceFound", description="The distance found between the found edges"),
    ] = None
    filter_polarity: typing_extensions.Annotated[
        typing.Optional[V1VisionStepResultsItemCaliperFilterPolarity],
        FieldMetadata(alias="filterPolarity"),
        pydantic.Field(
            alias="filterPolarity",
            description="The configured polarity for finding edges. Valid values: `LIGHT TO DARK`, `DARK TO LIGHT`.",
        ),
    ] = None
    max_distance: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="maxDistance"),
        pydantic.Field(alias="maxDistance", description="The maximum allowed distance threshold"),
    ] = None
    min_distance: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="minDistance"),
        pydantic.Field(alias="minDistance", description="The minumum allowed distance threshold"),
    ] = None
    sharpness_range: typing_extensions.Annotated[
        typing.Optional[V1VisionStepResultsItemCaliperSharpnessRange],
        FieldMetadata(alias="sharpnessRange"),
        pydantic.Field(alias="sharpnessRange", description="The configured sharpness allowance range"),
    ] = None
    straightness_range: typing_extensions.Annotated[
        typing.Optional[V1VisionStepResultsItemCaliperStraightnessRange],
        FieldMetadata(alias="straightnessRange"),
        pydantic.Field(alias="straightnessRange", description="The configured straightness allowance range"),
    ] = None
    unit: typing.Optional[str] = pydantic.Field(default=None)
    """
    The measurement unit of the distance found and the min and max distance threshold
    """

    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
