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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .inventory_state import InventoryState
from .source_application import SourceApplication
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class InventoryPhysicalCount(UncheckedBaseModel):
    """
    Represents the quantity of an item variation that is physically present
    at a specific location, verified by a seller or a seller's employee. For example,
    a physical count might come from an employee counting the item variations on
    hand or from syncing with an external system.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    A unique Square-generated ID for the
    [InventoryPhysicalCount](entity:InventoryPhysicalCount).
    """

    reference_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    An optional ID provided by the application to tie the
    [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external
    system.
    """

    catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-generated ID of the
    [CatalogObject](entity:CatalogObject) being tracked.
    """

    catalog_object_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. 
    
    The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. 
    In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
    """

    state: typing.Optional[InventoryState] = pydantic.Field(default=None)
    """
    The current [inventory state](entity:InventoryState) for the related
    quantity of items.
    See [InventoryState](#type-inventorystate) for possible values
    """

    location_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-generated ID of the [Location](entity:Location) where the related
    quantity of items is being tracked.
    """

    quantity: typing.Optional[str] = pydantic.Field(default=None)
    """
    The number of items affected by the physical count as a decimal string.
    The number can support up to 5 digits after the decimal point.
    """

    source: typing.Optional[SourceApplication] = pydantic.Field(default=None)
    """
    Information about the application with which the
    physical count is submitted.
    """

    employee_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-generated ID of the [Employee](entity:Employee) responsible for the
    physical count.
    """

    team_member_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
    physical count.
    """

    occurred_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    A client-generated RFC 3339-formatted timestamp that indicates when
    the physical count was examined. For physical count updates, the `occurred_at`
    timestamp cannot be older than 24 hours or in the future relative to the
    time of the request.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    An RFC 3339-formatted timestamp that indicates when the physical count is received.
    """

    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
