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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .type_enum import TypeEnum


class TaskAssignment(UncheckedBaseModel):
    """
    TaskAssignment Serializer with FSM state support.

    Note: The 'state' field will be populated from the queryset annotation
    if present, preventing N+1 queries. Use .with_state() on your queryset.

    The state field display is controlled by both:
    - fflag_feat_fit_568_finite_state_management (FSM background calculations)
    - fflag_feat_fit_710_fsm_state_fields (state field display in APIs)
    """

    assignee: int = pydantic.Field()
    """
    Assigned user
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Time of assignment
    """

    id: typing.Optional[int] = None
    state: typing.Optional[str] = None
    task: int = pydantic.Field()
    """
    Assigned task
    """

    type: typing.Optional[TypeEnum] = pydantic.Field(default=None)
    """
    Type of assignment: Annotate|Review
    
    * `AN` - Annotate
    * `RE` - Review
    """

    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
