"""天翼云盘数据清理 v1.0.0"""

import logging
from typing import List

logger = logging.getLogger(__name__)


class Cloud189Cleanup:
    API_BASE = "https://cloud.189.cn/api/open/file"

    def delete_files(self, session, credential_mgr, file_ids: List[str]) -> bool:
        try:
            resp = session.post(
                f"{self.API_BASE}/deleteFiles.action",
                data={"fileIdList": ",".join(file_ids)},
                timeout=30,
            )
            return resp.json().get("res_code") == 0
        except Exception as e:
            logger.error(f"189 delete failed: {e}")
            return False

    def filter_ad_ids(self, file_ids: List[str], file_names: List[str],
                      banned_keywords: List[str]) -> List[str]:
        return file_ids
