# 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
from .playwright_wait_for_load_state import PlaywrightWaitForLoadState


class Playwright(UncheckedBaseModel):
    scraper_type: typing.Literal["playwright"] = "playwright"
    wait_for_load_state: typing.Optional[PlaywrightWaitForLoadState] = pydantic.Field(default=None)
    """
    Determines when the scraper considers navigation to be finished.
    """

    wait_for_timeout: typing.Optional[int] = pydantic.Field(default=None)
    """
    Additional wait time in milliseconds after page load to allow JavaScript hydration. Only applies to Playwright scraper.
    """

    wait_for_event: typing.Optional[str] = pydantic.Field(default=None)
    """
    Wait for a custom page/window event (e.g., 'appLoaded') before scraping. The page must dispatch this event via window.dispatchEvent(new Event('eventName')). Playwright only.
    """

    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
