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

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata


class Task(UniversalBaseModel):
    """
    A work task stored as a Firestore document and rendered in the Gantt chart. Dates are ISO 8601 strings (mapped to Firestore Timestamp on read/write).
    """

    id: int
    text: str
    details: str
    start: dt.datetime
    end: dt.datetime
    assigned_to: typing_extensions.Annotated[str, FieldMetadata(alias="assignedTo"), pydantic.Field(alias="assignedTo")]
    created_by: typing_extensions.Annotated[str, FieldMetadata(alias="createdBy"), pydantic.Field(alias="createdBy")]
    parent: typing.Optional[str] = None
    completed: bool
    progress: float
    created_at: typing_extensions.Annotated[
        dt.datetime, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")
    ]
    updated_at: typing_extensions.Annotated[
        dt.datetime, FieldMetadata(alias="updatedAt"), pydantic.Field(alias="updatedAt")
    ]

    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
