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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel


class HealedStep(UncheckedBaseModel):
    """
    Record of a step that was auto-fixed during execution.
    """

    step_index: int = pydantic.Field()
    """
    Index of the step that was healed
    """

    original_selector: typing.Optional[str] = pydantic.Field(default=None)
    """
    Original selector that failed
    """

    healed_selector: str = pydantic.Field()
    """
    Working selector found by self-healing
    """

    healed_by: str = pydantic.Field()
    """
    Method used: smart_locator, ai, ai_alternative
    """

    error: str = pydantic.Field()
    """
    Original error that triggered healing
    """

    confidence: typing.Optional[float] = pydantic.Field(default=None)
    """
    AI confidence (0-1)
    """

    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
