import typer
from acemist.print_utils.print_network_templates import (
    print_list_network_templates,
    print_network_template_details,
)
from acemist.commands import networktemplates_networks


app = typer.Typer(help="Manage Network Templates.")
app.add_typer(networktemplates_networks.app, name="networks")


@app.command("list")
def list_templates(ctx: typer.Context):
    """List all sites."""
    mist = ctx.obj.mist
    templates = mist.network_templates_list()
    print_list_network_templates(templates)


@app.command("details")
def get_template_details(
    ctx: typer.Context,
    template_id: str = typer.Argument(..., help="Site ID")
):
    """Get details for a specific site."""
    mist = ctx.obj.mist
    template = mist.network_templates_get(template_id)
    print_network_template_details(template)


