"""
Unified reference data management CLI commands.

Replaces the split reference/usage-reference system with a single
unified dataset and streamlined commands focused on pipeline config creation.
"""

import typer
from .add import app as add_app
from .explore import app as explore_app
from .flush import app as flush_app
from .status import app as status_app
from .versions import app as versions_app
from .s3_ops import download, upload, s3_status, sync_status

# Create data command group
app = typer.Typer(help="Reference data management (add, explore, flush, status, versions, S3 sync)")
app.add_typer(add_app, name="add")
app.add_typer(explore_app, name="explore")
app.add_typer(flush_app, name="flush")
app.add_typer(status_app, name="status")
app.add_typer(versions_app, name="versions")

app.command("download")(download)
app.command("upload")(upload)
app.command("sync-status")(sync_status)
app.command("s3-status")(s3_status)

# Add rollback as a top-level command
from .versions import VersionsCommand

@app.command("rollback")
def rollback(
    force: bool = typer.Option(False, "--force", help="Skip confirmation prompts")
):
    """Undo last operation by restoring to previous version."""
    # Lazy initialization - create instance only when command executes
    VersionsCommand().rollback_last_operation(force=force)

__all__ = ["app"]