import typer
from typing_extensions import Annotated
from pathlib import Path

from .pack import make_urdfz_file
from .unpack import unpack_urdfz_file

cli = typer.Typer(no_args_is_help=True)


@cli.command()
def pack(
    path: Annotated[
        Path, typer.Argument(help="The path to the URDF file to pack", exists=True)
    ],
):
    """Packs a URDF and all its assets into a URDFZ file."""
    make_urdfz_file(path)


@cli.command()
def unpack(
    path: Annotated[
        Path, typer.Argument(help="The path to the URDFZ file to unpack", exists=True)
    ],
):
    """Unpacks a URDFZ into its component URDF file and assets."""
    unpack_urdfz_file(path)


def main():
    """Main entry point for the CLI."""
    cli()


if __name__ == "__main__":
    main()
