# 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 .annotation_request import AnnotationRequest
from .prediction_request import PredictionRequest


class ImportApiRequest(UncheckedBaseModel):
    """
    Tasks serializer for Import API (TaskBulkCreateAPI)
    """

    allow_skip: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether this task can be skipped. Set to False to make task unskippable.
    """

    annotations: typing.Optional[typing.List[AnnotationRequest]] = None
    cancelled_annotations: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of total cancelled annotations for the current task
    """

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

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

    data: typing.Any
    file_upload: typing.Optional[int] = pydantic.Field(default=None)
    """
    Uploaded file used as data source for this task
    """

    inner_id: typing.Optional[int] = pydantic.Field(default=None)
    """
    Internal task ID in the project, starts with 1
    """

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

    meta: 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.
    """

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

    precomputed_agreement: typing.Optional[float] = pydantic.Field(default=None)
    """
    Average agreement score for the task
    """

    predictions: typing.Optional[typing.List[PredictionRequest]] = None
    total_annotations: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of total annotations for the current task except cancelled annotations
    """

    total_predictions: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of total predictions for the current task
    """

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

    updated_by: typing.Optional[int] = pydantic.Field(default=None)
    """
    Last annotator or reviewer who updated this task
    """

    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
