#!/usr/bin/env python3
"""
Legacy script for full dataset processing.
This script now redirects to the new CLI command for better functionality.
"""

import sys
import subprocess
from pathlib import Path

def main():
    print("🔄 Redirecting to new CLI command...")
    print("📝 Use: docker-compose run --rm musicbrainz-cleaner python3 -m src.cli.main --process-full-dataset")
    print()
    
    # Get the current script's directory
    script_dir = Path(__file__).parent
    
    # Build the new command
    cmd = [
        "docker-compose", "run", "--rm", "musicbrainz-cleaner",
        "python3", "-m", "src.cli.main", "--process-full-dataset"
    ]
    
    # Add any additional arguments passed to this script
    if len(sys.argv) > 1:
        cmd.extend(sys.argv[1:])
    
    try:
        # Change to the script directory and run the command
        subprocess.run(cmd, cwd=script_dir, check=True)
    except subprocess.CalledProcessError as e:
        print(f"❌ Error running command: {e}")
        sys.exit(1)
    except FileNotFoundError:
        print("❌ Error: docker-compose not found. Make sure Docker is running.")
        print("💡 Alternative: Run directly with:")
        print("   python3 -m src.cli.main --process-full-dataset")
        sys.exit(1)

if __name__ == "__main__":
    main() 