"""Attachment queue handlers for MAX surface.""" from adapter.max.store import ChatStore class AttachmentHandler: def __init__(self, store: ChatStore): self.store = store def handle_list(self, max_chat_id: str) -> str: attachments = self.store.get_attachments(max_chat_id) if not attachments: return "Attachment queue is empty." lines = [f" {i+1}. {name}" for i, (_, name) in enumerate(attachments)] return "\n".join(lines) def handle_remove(self, max_chat_id: str, index: str) -> str: attachments = self.store.staged_attachments.get(max_chat_id, []) if index.lower() == "all": self.store.staged_attachments[max_chat_id] = [] return "All attachments removed from queue." try: idx = int(index) - 1 if 0 <= idx < len(attachments): removed = attachments.pop(idx) return f"Removed: {removed[1]}" return "Invalid index." except ValueError: return "Usage: !remove or !remove all"