from datetime import datetime
from uuid import UUID

from pydantic import Field

from tacoq.core.models.avro_serializable_base_model import (
    AvroSerializableBaseModel,
    avro_schema_path,
)


@avro_schema_path("schemas/avro/task_running_update.json")
class TaskRunningUpdate(AvroSerializableBaseModel):
    """Update of a task starting execution by a worker."""

    id: UUID
    """The unique ID of the task. Generated by the client so that it can be 
    communicated to the relay and the workers directly."""

    started_at: datetime
    """ The time the task was started at. """

    executed_by: str
    """ The name of the worker that is executing the task. """

    update_type: str = Field(default="Running")
    """ The type of update. """
