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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .scheduled_shift_details import ScheduledShiftDetails
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class ScheduledShift(UncheckedBaseModel):
    """
    Represents a specific time slot in a work schedule. This object is used to manage the
    lifecycle of a scheduled shift from the draft to published state. A scheduled shift contains
    the latest draft shift details and current published shift details.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    **Read only** The Square-issued ID of the scheduled shift.
    """

    draft_shift_details: typing.Optional[ScheduledShiftDetails] = pydantic.Field(default=None)
    """
    The latest draft shift details for the scheduled shift. Draft shift details are used to
    stage and manage shifts before publishing. This field is always present.
    """

    published_shift_details: typing.Optional[ScheduledShiftDetails] = pydantic.Field(default=None)
    """
    The current published (public) shift details for the scheduled shift. This field is
    present only if the shift was published.
    """

    version: typing.Optional[int] = pydantic.Field(default=None)
    """
    **Read only** The current version of the scheduled shift, which is incremented with each update.
    This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
    control to ensure that requests don't overwrite data from another request.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp of when the scheduled shift was created, in RFC 3339 format presented as UTC.
    """

    updated_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    The timestamp of when the scheduled shift was last updated, in RFC 3339 format presented as UTC.
    """

    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
