import os
import django

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

from users.models import CustomUser

# Create superuser
try:
    user = CustomUser.objects.create_superuser(
        username='admin',
        email='admin@example.com',
        password='admin123',
        first_name='Admin',
        last_name='User',
        phone_number='+254700000000',
        role='admin'
    )
    print(f"Superuser created successfully!")
    print(f"Username: admin")
    print(f"Password: admin123")
except Exception as e:
    print(f"Error: {e}")
