#!/usr/bin/env python3
"""
Setup script for simplified permissions system
"""

import os
import sys
import django

# Add the project directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

# Setup Django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'branch_system.settings')
django.setup()

from django.core.management import call_command

def main():
    print("🔧 Setting up simplified permissions system...")
    
    try:
        # Run the management command
        call_command('setup_simplified_permissions')
        
        print("\n✅ Simplified permissions system setup completed!")
        print("\n📋 Next steps:")
        print("1. Access the admin panel at /users/admins/")
        print("2. Click on any user to manage their permissions")
        print("3. Use the simplified permissions interface at /users/simplified-permissions/<user_id>/")
        print("\n🎯 Features available:")
        print("- Streamlined permission interface")
        print("- Quick action buttons (Select All, Deselect All, etc.)")
        print("- Module-based permission grouping")
        print("- Visual feedback for permission changes")
        print("- Custom permission overrides")
        
    except Exception as e:
        print(f"❌ Error setting up permissions: {e}")
        sys.exit(1)

if __name__ == '__main__':
    main()