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

import datetime as dt
import typing

from ..core.datetime_utils import serialize_datetime
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1


class Task(pydantic_v1.BaseModel):
    id: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Unique ID of the task
    """

    predictions: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
    """
    Predictions for this task
    """

    annotations: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
    """
    Annotations for this task
    """

    drafts: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
    """
    Drafts for this task
    """

    annotators: typing.Optional[typing.List[int]] = pydantic_v1.Field(default=None)
    """
    List of annotators' IDs for this task
    """

    inner_id: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Inner ID of the task
    """

    cancelled_annotations: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Number of cancelled annotations for this task
    """

    total_annotations: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Total number of annotations for this task
    """

    total_predictions: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Total number of predictions for this task
    """

    completed_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
    """
    Completion time of the task
    """

    file_upload: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    File upload ID for this task
    """

    storage_filename: typing.Optional[str] = pydantic_v1.Field(default=None)
    """
    Storage filename for this task
    """

    avg_lead_time: typing.Optional[float] = pydantic_v1.Field(default=None)
    """
    Average lead time for this task
    """

    draft_exists: typing.Optional[bool] = pydantic_v1.Field(default=None)
    """
    Whether a draft exists for this task or not
    """

    updated_by: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
    """
    List of annotators' info who updated this task
    """

    data: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
    """
    Data of the task
    """

    meta: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
    """
    Meta information of the task
    """

    created_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
    """
    Creation time of the task
    """

    updated_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
    """
    Last updated time of the task
    """

    is_labeled: typing.Optional[bool] = pydantic_v1.Field(default=None)
    """
    Whether the task is labeled or not
    """

    overlap: typing.Optional[float] = pydantic_v1.Field(default=None)
    """
    Overlap for the task
    """

    comment_count: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Number of comments for this task
    """

    unresolved_comment_count: typing.Optional[int] = pydantic_v1.Field(default=None)
    """
    Number of unresolved comments for this task
    """

    last_comment_updated_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
    """
    Last updated time of the comments for this task
    """

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

    comment_authors: typing.Optional[typing.List[int]] = pydantic_v1.Field(default=None)
    """
    List of comment authors' IDs for this task
    """

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

        return deep_union_pydantic_dicts(
            super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
        )

    class Config:
        frozen = True
        smart_union = True
        extra = pydantic_v1.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}
