"""# Summary Jobs domain — the worker's queue. Each job is a unit of pipeline work the background worker claims and executes. """ from typing import Literal from pydantic import BaseModel from domain.parents.models import Metadata class Job(BaseModel): """A unit of background work. Attributes: id (int | None): Server-assigned identifier. Defaults to None. name (str): Human label for the job. kind (str): Dispatch key — selects the pipeline (e.g. ``appointment_reminder``). status (str): Lifecycle status. Defaults to ``pending``. payload (dict | None): Job-specific input. Defaults to None. retry_count (int): Failed attempts so far. Defaults to 0. error_message (str | None): Last failure detail. Defaults to None. metadata (Metadata | None): Presentation metadata. Defaults to None. """ id: int | None = None name: str kind: str status: Literal["pending", "processing", "done", "failed"] = "pending" payload: dict | None = None retry_count: int = 0 error_message: str | None = None metadata: Metadata | None = None model_config = {"extra": "ignore"}