from __future__ import annotations

import logging
from typing import Any

from .common import _utc_timestamp

logger = logging.getLogger("dscons.desktop_automation.zalo_files")


class DesktopZaloFilesMixin:
    """Zalo automated file downloading and attachment handling."""

    async def zalo_download_latest_file(
        self,
        download_dir: str,
        timeout_seconds: float = 60.0,
    ) -> dict[str, Any]:
        """Download the latest visible file from the active Zalo chat."""
        return {
            "ok": False,
            "action": "zalo_download_latest_file",
            "timestamp": _utc_timestamp(),
            "data": {
                "download_dir": download_dir,
                "timeout_seconds": timeout_seconds,
                "backend": "unsupported",
            },
            "artifacts": {},
            "error": {
                "code": "unsupported_operation",
                "message": "Zalo file download is not available in the current DSCons desktop backend.",
                "details": {},
            },
        }
