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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .engine_type import EngineType


class SiteAnalysisResponse(UniversalBaseModel):
    """
    Response model for site analysis.
    """

    url: str = pydantic.Field()
    """
    Analyzed URL
    """

    estimated_items: typing.Optional[int] = pydantic.Field(default=None)
    """
    Estimated number of items on page
    """

    complexity: str = pydantic.Field()
    """
    Site complexity: low|medium|high
    """

    requires_js: bool = pydantic.Field()
    """
    Requires JavaScript rendering
    """

    is_spa: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Single Page Application
    """

    has_anti_bot: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Has anti-bot measures
    """

    estimated_processing_time: float = pydantic.Field()
    """
    Estimated time in seconds
    """

    recommended_limits: typing.Dict[str, int] = pydantic.Field()
    """
    Recommended max_items and timeout
    """

    recommended_engine: EngineType = pydantic.Field()
    """
    Recommended scraping engine
    """

    pagination_detected: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether pagination was detected
    """

    robots_txt_restrictions: typing.Optional[str] = pydantic.Field(default=None)
    """
    Any robots.txt restrictions
    """

    content_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    Content type from headers
    """

    status_code: typing.Optional[int] = pydantic.Field(default=None)
    """
    HTTP status code
    """

    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
