from typing import List, Dict, Any
from .auth_manager import AuthManager
from .utils import clean_html

class MessageManager:
    def __init__(self, auth: AuthManager):
        self.auth = auth

    def get_ticket_messages(self, ticket_id: int) -> List[Dict[str, Any]]:
        params = {
            "model": "mail.message",
            "method": "search_read",
            "args": [[[ "res_id", "=", ticket_id], ["model", "=", "project.task"]]],
            "kwargs": {"fields": ["id", "body", "author_id", "date"]}
        }
        return self.auth._rpc_call("/web/dataset/call_kw", params)
