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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .data_manager_task_serializer_predictions_item import DataManagerTaskSerializerPredictionsItem
import pydantic
from .annotations_dm_field import AnnotationsDmField
from .data_manager_task_serializer_drafts_item import DataManagerTaskSerializerDraftsItem
from .data_manager_task_serializer_annotators_item import DataManagerTaskSerializerAnnotatorsItem
import datetime as dt
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class DataManagerTaskSerializer(UniversalBaseModel):
    id: typing.Optional[int] = None
    predictions: typing.Optional[typing.List[DataManagerTaskSerializerPredictionsItem]] = pydantic.Field(default=None)
    """
    Predictions for this task
    """

    annotations: typing.Optional[typing.List[AnnotationsDmField]] = None
    drafts: typing.Optional[typing.List[DataManagerTaskSerializerDraftsItem]] = pydantic.Field(default=None)
    """
    Drafts for this task
    """

    annotators: typing.Optional[typing.List[DataManagerTaskSerializerAnnotatorsItem]] = pydantic.Field(default=None)
    """
    Annotators who annotated this task
    """

    inner_id: typing.Optional[int] = None
    cancelled_annotations: typing.Optional[int] = None
    total_annotations: typing.Optional[int] = None
    total_predictions: typing.Optional[int] = None
    completed_at: typing.Optional[dt.datetime] = None
    annotations_results: typing.Optional[str] = None
    predictions_results: typing.Optional[str] = None
    predictions_score: typing.Optional[float] = None
    file_upload: typing.Optional[str] = None
    storage_filename: typing.Optional[str] = None
    annotations_ids: typing.Optional[str] = None
    predictions_model_versions: typing.Optional[str] = None
    avg_lead_time: typing.Optional[float] = None
    draft_exists: typing.Optional[bool] = None
    updated_by: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = pydantic.Field(
        default=None
    )
    """
    User IDs who updated this task
    """

    data: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field()
    """
    User imported or uploaded data for a task. Data is formatted according to the project label config. You can find examples of data for your project on the Import page in the Label Studio Data Manager UI.
    """

    meta: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Meta is user imported (uploaded) data and can be useful as input for an ML Backend for embeddings, advanced vectors, and other info. It is passed to ML during training/predicting steps.
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Time a task was created
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Last time a task was updated
    """

    is_labeled: typing.Optional[bool] = pydantic.Field(default=None)
    """
    True if the number of annotations for this task is greater than or equal to the number of maximum_completions for the project
    """

    overlap: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of distinct annotators that processed the current task
    """

    comment_count: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of comments in the task including all annotations
    """

    unresolved_comment_count: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of unresolved comments in the task including all annotations
    """

    last_comment_updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the last comment was updated
    """

    project: typing.Optional[int] = pydantic.Field(default=None)
    """
    Project ID for this task
    """

    comment_authors: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
    """
    Users who wrote comments
    """

    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
