from rich.console import Console
from rich.panel import Panel
from rich.table import Table

console = Console()


def docs():
    """
    How to use terrafy
    """
    # Workflow instructions shown before the command table
    console.print(
        Panel(
            "[bold]Step 1:[/bold] [cyan]terrafy authenticate <GEMINI_API_KEY>[/cyan]\n"
            '[bold]Step 2:[/bold] [cyan]terrafy create "<your infrastructure request>"[/cyan]',
            title="Quick Start",
            border_style="green",
        )
    )

    table = Table(title="terrafy Commands")
    table.add_column("Command", style="cyan", no_wrap=True)
    table.add_column("Description", style="magenta")
    table.add_column("Example", style="green")

    table.add_row(
        "authenticate",
        "Authenticate with Gemini",
        "terrafy authenticate sk-qwerty",
    )
    table.add_row(
        "create",
        "Generate HCL from a natural language request",
        'terrafy create "S3 bucket for images prefixed with env and project"',
    )

    console.print(table)
