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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .task_base_navigation_payload import TaskBaseNavigationPayload
from .proxy_location import ProxyLocation
from .task_base_extracted_information_schema import TaskBaseExtractedInformationSchema
from .task_type import TaskType
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class TaskBase(UniversalBaseModel):
    title: typing.Optional[str] = pydantic.Field(default=None)
    """
    The title of the task.
    """

    url: str = pydantic.Field()
    """
    Starting URL for the task.
    """

    webhook_callback_url: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL to call when the task is completed.
    """

    totp_verification_url: typing.Optional[str] = None
    totp_identifier: typing.Optional[str] = None
    navigation_goal: typing.Optional[str] = pydantic.Field(default=None)
    """
    The user's goal for the task.
    """

    data_extraction_goal: typing.Optional[str] = pydantic.Field(default=None)
    """
    The user's goal for data extraction.
    """

    navigation_payload: typing.Optional[TaskBaseNavigationPayload] = pydantic.Field(default=None)
    """
    The user's details needed to achieve the task.
    """

    error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
    """
    The mapping of error codes and their descriptions.
    """

    proxy_location: typing.Optional[ProxyLocation] = pydantic.Field(default=None)
    """
    The location of the proxy to use for the task.
    """

    extracted_information_schema: typing.Optional[TaskBaseExtractedInformationSchema] = pydantic.Field(default=None)
    """
    The requested schema of the extracted information.
    """

    complete_criterion: typing.Optional[str] = pydantic.Field(default=None)
    """
    Criterion to complete
    """

    terminate_criterion: typing.Optional[str] = pydantic.Field(default=None)
    """
    Criterion to terminate
    """

    task_type: typing.Optional[TaskType] = pydantic.Field(default=None)
    """
    The type of the task
    """

    application: typing.Optional[str] = pydantic.Field(default=None)
    """
    The application for which the task is running
    """

    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
