"""Download job domain entity (plan §6.1).

A queued fetch from an external source, tracked through its lifecycle so the UI
download manager (screen §A5) can show progress, errors, and retries. The
``status`` strings mirror :class:`~app.infrastructure.db.models.enums.DownloadStatus`.
"""

import datetime as dt
import uuid
from dataclasses import dataclass


@dataclass(frozen=True, slots=True)
class DownloadJob:
    id: uuid.UUID
    source: str
    source_id: str | None
    query: str | None
    requested_by: uuid.UUID | None
    status: str
    progress: float
    error_message: str | None
    retry_count: int
    track_id: uuid.UUID | None
    created_at: dt.datetime
    updated_at: dt.datetime
