"""Discord channel adapter for Grukk.

Optional Discord presence that allows Grukk to send messages and status
updates to a configured Discord server.  Uses the existing discord
infrastructure in peon-mcp (discord_configs, discord_channel_mappings).
"""

from __future__ import annotations


class DiscordChannel:
    """Optional Discord presence for Grukk.

    Parameters
    ----------
    api_url:
        Peon REST API base URL (Discord messages are routed through the API's
        existing Discord integration).
    api_key:
        Optional API key for authenticated requests.

    TODO:
    - Integrate with the existing discord message API endpoints.
    - Support channel mapping (e.g., approvals go to #approvals channel,
      status updates go to #peon-status).
    - Support Discord embeds for rich formatting of status reports.
    - Handle Discord rate limits gracefully.
    """

    def __init__(self, api_url: str, api_key: str = "") -> None:
        self.api_url = api_url
        self.api_key = api_key

    async def send(self, channel_id: str, content: str) -> bool:
        """Send a message to a Discord channel.

        Parameters
        ----------
        channel_id:
            Discord channel ID to send the message to.
        content:
            Message content (Discord markdown supported).

        Returns
        -------
        bool
            True if the message was sent successfully.

        TODO:
        - POST to the Discord message API endpoint.
        - Support embed formatting for structured data (loop status,
          approval requests, etc.).
        - Handle errors and log failures.
        """
        return False
