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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .order_custom_property_response_body import OrderCustomPropertyResponseBody
from .order_quantity_response_body import OrderQuantityResponseBody
from .order_task_response_body import OrderTaskResponseBody


class OrderObjectResponseBody(UniversalBaseModel):
    """
    Order object
    """

    created_at: typing_extensions.Annotated[
        dt.datetime,
        FieldMetadata(alias="createdAt"),
        pydantic.Field(alias="createdAt", description="The timestamp (in UTC) when the order was created"),
    ]
    custom_properties: typing_extensions.Annotated[
        typing.List[OrderCustomPropertyResponseBody],
        FieldMetadata(alias="customProperties"),
        pydantic.Field(alias="customProperties", description="An array of custom property values for the order"),
    ]
    customer_order_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="customerOrderId"),
        pydantic.Field(alias="customerOrderId", description="The customer-provided identifier for the order"),
    ]
    delivery: typing.Optional[OrderTaskResponseBody] = None
    hub_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="hubId"),
        pydantic.Field(alias="hubId", description="The ID of the hub the order belongs to"),
    ]
    id: str = pydantic.Field()
    """
    The Samsara-generated unique identifier (UUID) for the order
    """

    pickup: typing.Optional[OrderTaskResponseBody] = None
    plan_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="planId"),
        pydantic.Field(alias="planId", description="The ID of the plan the order belongs to"),
    ]
    priority: int = pydantic.Field()
    """
    Priority of the order (e.g., 1 for high, 5 for low)
    """

    quantities: typing.List[OrderQuantityResponseBody] = pydantic.Field()
    """
    An array of quantities for the order
    """

    skills_required: typing_extensions.Annotated[
        typing.List[str],
        FieldMetadata(alias="skillsRequired"),
        pydantic.Field(alias="skillsRequired", description="An array of skill IDs required to fulfill the order"),
    ]
    updated_at: typing_extensions.Annotated[
        dt.datetime,
        FieldMetadata(alias="updatedAt"),
        pydantic.Field(alias="updatedAt", description="The timestamp (in UTC) when the order was last updated"),
    ]

    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
