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

from ..core.pydantic_utilities import UniversalBaseModel
import typing_extensions
import typing
from .monitor_config_include_visual_analysis import MonitorConfigIncludeVisualAnalysis
from ..core.serialization import FieldMetadata
import pydantic
from .interval_monitor_config import IntervalMonitorConfig
from .browser_wait_selector_config import BrowserWaitSelectorConfig
from .monitor_config_monitor_type import MonitorConfigMonitorType
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class MonitorConfig(UniversalBaseModel):
    include_visual_analysis: typing_extensions.Annotated[
        typing.Optional[MonitorConfigIncludeVisualAnalysis], FieldMetadata(alias="includeVisualAnalysis")
    ] = pydantic.Field(default=None)
    """
    If set to 'enabled', Airtop AI will also analyze the web page visually when executing the condition check. If set to 'disabled', no visual analysis will be conducted.
    """

    interval: typing.Optional[IntervalMonitorConfig] = pydantic.Field(default=None)
    """
    Configuration for the interval monitor. Only used when monitorType is 'interval'.
    """

    monitor_selector_options: typing_extensions.Annotated[
        typing.Optional[BrowserWaitSelectorConfig], FieldMetadata(alias="monitorSelectorOptions")
    ] = pydantic.Field(default=None)
    """
    Configuration for the browser wait selector.
    """

    monitor_type: typing_extensions.Annotated[MonitorConfigMonitorType, FieldMetadata(alias="monitorType")] = (
        pydantic.Field()
    )
    """
    The type of monitoring to perform. Interval executes the condition check at a regular, specified interval. Selector waits for a selector to be present before completing.
    """

    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
