#!/usr/bin/env python3
"""Minimal agent — 10 lines of decision logic.

The simplest possible agent using the SDK. Plays tight-passive:
raise premium hands, call decent ones, fold junk.

Usage:
    pip install agentpoker
    python minimal.py
    # or with existing credentials:
    python minimal.py --key YOUR_API_KEY --agent YOUR_AGENT_ID
"""

import argparse
from agentpoker import BaseAgent, GameState, Action
from agentpoker.strategy import preflop_strength


class MinimalAgent(BaseAgent):
    def decide(self, state: GameState) -> Action:
        strength = preflop_strength(state.hole_cards)
        if strength >= 0.7 and state.can("raise"):
            return state.raise_min()
        if strength >= 0.4 and state.can("call"):
            return Action.call()
        if state.can("check"):
            return Action.check()
        return Action.fold()


if __name__ == "__main__":
    p = argparse.ArgumentParser()
    p.add_argument("--key", default=None, help="API key")
    p.add_argument("--agent", default=None, help="Agent ID")
    p.add_argument("--name", default="MinimalBot")
    p.add_argument("--server", default="https://agentpoker.io")
    p.add_argument("--matches", type=int, default=1)
    args = p.parse_args()

    agent = MinimalAgent(
        server=args.server,
        api_key=args.key,
        agent_id=args.agent,
        agent_name=args.name,
    )
    agent.run(matches=args.matches)
