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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .appointment_window_request_body import AppointmentWindowRequestBody
from .order_task_request_body_position import OrderTaskRequestBodyPosition


class OrderTaskRequestBody(UniversalBaseModel):
    """
    Order task
    """

    address: typing.Optional[str] = pydantic.Field(default=None)
    """
    The full address string for the order
    """

    appointment_window: typing_extensions.Annotated[
        typing.Optional[AppointmentWindowRequestBody],
        FieldMetadata(alias="appointmentWindow"),
        pydantic.Field(alias="appointmentWindow"),
    ] = None
    customer_location_id: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="customerLocationId"),
        pydantic.Field(
            alias="customerLocationId",
            description="The customer-provided identifier of the location associated with the order",
        ),
    ] = None
    latitude: typing.Optional[float] = pydantic.Field(default=None)
    """
    Latitude of the order. Optional if address is provided; the address will be geocoded to obtain coordinates.
    """

    longitude: typing.Optional[float] = pydantic.Field(default=None)
    """
    Longitude of the order. Optional if address is provided; the address will be geocoded to obtain coordinates.
    """

    notes: typing.Optional[str] = pydantic.Field(default=None)
    """
    Any additional notes for the order
    """

    position: typing.Optional[OrderTaskRequestBodyPosition] = pydantic.Field(default=None)
    """
    Position constraint for the order task  Valid values: `first`, `last`, `any`
    """

    service_time_seconds: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="serviceTimeSeconds"),
        pydantic.Field(alias="serviceTimeSeconds", description="Estimated service time for the order in seconds"),
    ] = None

    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
