import typer

from strura.commands.init import init_project
from strura.commands.gen_context import gen_context
from strura.commands.gen_model import gen_model


app = typer.Typer(
    name="strura",
    help="Strura - The Architect's CLI. Constructing solid foundations for your code.",
    add_completion=False,
)


@app.command("init")
def cmd_init(
    name: str = typer.Argument(
        help="Project name to create, or '.' to format the current directory.",
    ),
) -> None:
    """Initialize a new project or format an existing one with the Strura DDD structure."""
    init_project(name)


@app.command("gen:context")
def cmd_gen_context(
    name: str = typer.Argument(
        help="Context name in snake_case (e.g., 'person', 'security').",
    ),
) -> None:
    """Generate a new bounded context with DDD layered architecture."""
    gen_context(name)


@app.command("gen:model")
def cmd_gen_model(
    entity: str = typer.Argument(
        ...,
        metavar="<context>.<model_name>",
        help="Entity to generate in dot notation. Example: person.address",
    ),
) -> None:
    """Generate a domain schema and database model for an entity."""
    gen_model(entity)


@app.command("hello-world")
def hello_world() -> None:
    """Prints a greeting message."""
    print("Hello, World!")


def main() -> None:
    app()


if __name__ == "__main__":
    main()
