from .types import ChannelActionContext


def handle_discord_action(ctx: ChannelActionContext) -> dict:
    if ctx.action == "send":
        return {
            "ok": True,
            "channel": ctx.channel,
            "action": ctx.action,
            "message_id": "discord-msg-001",
            "to": str(ctx.params.get("to", "")),
        }
    if ctx.action == "poll":
        return {
            "ok": True,
            "channel": ctx.channel,
            "action": ctx.action,
            "poll_id": "discord-poll-001",
            "to": str(ctx.params.get("to", "")),
        }
    if ctx.action in ("react", "delete"):
        return {"ok": True, "channel": ctx.channel, "action": ctx.action}
    raise ValueError(f"Action {ctx.action} not supported for channel {ctx.channel}")

